This is handy - take the optimiser stats from your production Postgres DB and load them into your local / dev database to check on realistic query plans without having to copy (and anonymise!) production data.

https://boringsql.com/posts/portable-stats/

#Postgres #TIL
Production query plans without production data

PostgreSQL 18 makes optimizer statistics portable. Export them from production and inject them into test databases to get realistic query plans without the data.

boringSQL | Supercharge your SQL & PostgreSQL powers
Turns out you can also do something similar with SQLite (albeit without any fancy functions - you have to handle the reading and writing yourself.)

https://sqlite.org/forum/forumpost/686b405382

(tyvm to @simon for posing the question in the first place.)

#SQLite #TIL #TYVM
SQLite User Forum: Feature suggestion: equivalent of PostgreSQL 18 pg_restore_relation_stats()