Posts

This profile is from a federated server and may be incomplete. Browse more on the original instance.

benoit, to PostgreSQL French
@benoit@ruby.social avatar

Yesterday we migrated many databases to 16.2. It went smoothly for all of them except one.
The database is used by Sidekiq for 90% of the traffic. We choose a time window outside of working hours, but still we had some traffic, and we didn't turn off pods. The database was inaccessible for 10min. Jobs rescheduled, and quickly auto-scaling was triggered. I was not able to perform ANALYZE. So requests retrying at the same time + huge disk read. 💥

esparta,
@esparta@ruby.social avatar

@benoit wow. You were brave there.

Don't get me wrong, my experience told me is usually not a good idea to rely on managed databases that much, if I had full control of the servers then it may be fine, we can do dry-runs multiple times and monitor before proceeding.

When I do not have control of the server I prefer to follow what Heroku have documented:

https://devcenter.heroku.com/articles/upgrading-heroku-postgres-databases

Basically: create an upgraded follower, sync, then switch over, drop the old leader - now the follower.

ascherbaum,
@ascherbaum@mastodon.social avatar

@esparta @benoit This is not really a issue, but how RDS handles the upgrade.

I also agree that creating a new follower and populating it with logical replication is a good choice.

benoit, to PostgreSQL French
@benoit@ruby.social avatar
benoit, to random French
@benoit@ruby.social avatar

I'm not a huge fan of this...

I don't know.

JonRowe,
@JonRowe@fosstodon.org avatar

@tekin @benoit +1 this, if you want to pass a module as a callable this is ok [but why do you need a module as a callable], the instance then is a bit weird but if you need to make things "private” I guess its... fine

pat, (edited )
@pat@hachyderm.io avatar

@JonRowe @tekin @benoit I must admit this is pattern I use a lot - though using Ruby's ellipsis for argument forwarding - and yes, for classes that perform a single action.

I find it removes needing to think about how to invoke the action (i.e. should it be .create, .save, .send? Less confusion, just always use .call).

And it’s the same interface for invoking procs (a use-case for which .new().call doesn't fit), so I can pass callable objects (proc, class, or instance) as arguments.

benoit, to random French
@benoit@ruby.social avatar

@joeldrapper I am curious. Why this indentation on litteral gem ? Reminds me of the code from @ioquatix

joeldrapper,
@joeldrapper@ruby.social avatar

@benoit @ioquatix cc @camertron out of interest, what would it take to get this added to GitHub? 🙏

:root {
tab-size: var(--tab-size-preference);
}

Somewhere in the layout:
<style>
:root {
--tab-size-preference: <%= @user.tab_size_preference %>
}
</style>

camertron,
@camertron@ruby.social avatar

@joeldrapper @benoit @ioquatix Hmm probably not too hard? I can bring it up with the right team on Monday.

benoit, to rails French
@benoit@ruby.social avatar

I observe devs in my company bringing back the "schema.rb" file from production into the Git repository.

I am uncertain about this practice. Modifying directly the schema.rb file has consistently been problematic for me. Perhaps it's less of an issue if you solely use schema:load, but I remain skeptical.

I would prefer a re-entering migration to rectify the schema, such as using 'create index if not exists.' This way, changes are propagated across all databases in various environments.

jamie,
@jamie@ruby.social avatar

@byroot @benoit I live in slight fear that our schema.rb does not actually match our production schema, even though theoretically it should. So this sort of back porting it from production is attractive at least as a sanity/anxiety check

benediktdeicke,
@benediktdeicke@mastodon.social avatar

@jamie @byroot @benoit Face your fears: DATABASE_URL=$(heroku config:get DATABASE_URL) rake db:schema:dump 😄

benoit, to random French
@benoit@ruby.social avatar

Many question on PostgreSQL's Slack could be answered by just typing the same question in a search engine and follow the first link. 😒

Di4na,
@Di4na@hachyderm.io avatar

@benoit That is true across all programming communities. My answer to this is that people feel far more natural to ask help to their community than to ask to a bloody broken machine.

benoit, to PostgreSQL French
@benoit@ruby.social avatar

I am wondering if it could be a good idea to have something similar to n_tup_upd but per queries in pg_stat_statements ? Like in pg_stat_all_tables.

benoit, to PostgreSQL
@benoit@ruby.social avatar

This week nearly full of was great. I still miss obvious stuff when looking at queries perf issues but I am an everlasting student. 😄

I love the community and the database.

benoit, to random French
@benoit@ruby.social avatar

It's interesting to see the discussions on the Twitter or elsewhere about the new gems that will probably be default soon in Rails and already existing OSS contributors that do similar things since multiple years.

I am wondering how those new librairies could benefit virtuously from the previous one:

  • Hiring partially previous maintainer to work on the new one?
  • Cleary extract concept and refere to previous implementation if maintainer and licence is ✅
Spone,

@benoit I'm a big fan of projects that include an "Other libraries" / "Inspiration" section in their readme. It doesn't cost anything to acknowledge the existing projects, it helps users find the library that's right for them and fosters a sense of community.

benoit, to PostgreSQL French
@benoit@ruby.social avatar

The last 2 week were full of SQL and PostgreSQL RDS. Sometimes it was difficult but always very interesting. I learn a lot and I really love the community and this piece of technology.
Still some frustrations but at least I know some caveats about the .

benoit,
@benoit@ruby.social avatar

@ferki Few points

https://ruby.social/@benoit/111130458599065037

And we finally found one query leading to that.

We had also a big freeze on one of our DB after an upgrade. We had to do a full analyze, then kill queries that were waiting because of BufferIO or DataFileRead.
We didn't understand what happen. Bad statistic? Query that block I/O 🤷

ferki,
@ferki@fosstodon.org avatar

@benoit Thanks for the insights, I'm glad you found a solution! I see you are in good hands with Lukas and pganalyze ;)

Stats are not preserved across major upgrades, thus requiring ANALYZE afterwards, as mentioned in the RDS upgrade guide:

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.PostgreSQL.html

There's also pg_stat_io for granular I/O statistics since PostgreSQL 16:

https://www.postgresql.org/about/news/postgresql-16-released-2715/

Hope this helps, and in case you need help with PostgreSQL performance (even commercially), feel free to reach out.

Happy hacking!

benoit, to random French
@benoit@ruby.social avatar
benoit, to PostgreSQL
@benoit@ruby.social avatar

Recently I worked a lot on performance issue on a db. Few things to remember.

  • Learn to read explain + use tools like the one from Dalibo
  • Planner can take wrong decisions
  • Create a snapshot with production data and tests index/settings/etc
  • Use psql
  • When testing indexes, remove the one used to see if the new one is used
  • PgAnalyze is a good tool
  • Keep a logbook of your work
  • Write a script with the queries that should be fast
    1/2
benoit, to PostgreSQL French
@benoit@ruby.social avatar

Indexing email column with hashtext for smaller index.

https://youtu.be/m8ogrogKjXo?t=773

louis,
@louis@emacs.ch avatar

@benoit Have you tried to use the Hash index option of PG for the same effect?

CREATE INDEX name ON table USING HASH (column);

benoit,
@benoit@ruby.social avatar

@louis I will try and publish the result

benoit, to random French
@benoit@ruby.social avatar

How do we hide/mute people on Slack ? 😅

Di4na,
@Di4na@hachyderm.io avatar

@benoit you complain to HR. You don't have HR? Well then i guess slack do not care about you.

benoit, to random
@benoit@ruby.social avatar

Les priorités à droite en agglomération, encore une idée qui devrait disparaître pour permettre aux enfants de plus prendre la route.
Je comprendrais jamais ces économies de panneaux, alors que tous les mois ces carrefours sont des sources d'accidents.

benoit,
@benoit@ruby.social avatar

@Di4na Ici y a des dos d'ânes en plus. Mais ça change pas grand chose.

Di4na,
@Di4na@hachyderm.io avatar

@benoit oh aussi! Et des rétrécissement et tout. Mais ça change rien

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • khanakhh
  • kavyap
  • thenastyranch
  • everett
  • tacticalgear
  • rosin
  • Durango
  • DreamBathrooms
  • mdbf
  • magazineikmin
  • InstantRegret
  • Youngstown
  • slotface
  • megavids
  • ethstaker
  • ngwrru68w68
  • cisconetworking
  • modclub
  • tester
  • osvaldo12
  • cubers
  • GTA5RPClips
  • normalnudes
  • Leos
  • provamag3
  • anitta
  • lostlight
  • All magazines