3 ms·
Postgres query planner suddenly deciding to do something silly in the middle of the night has taken Notion down a few times. It's quite annoying, and it's very
by jitl 3y ago
Postgres query planner suddenly deciding to do something silly in the middle of the night has taken Notion down a few times. It's quite annoying, and it's very frustrating to have no recourse.
- jhas78asd 3y agoAny posts on this? Are there bulk data loads that make table stats more stale and affect plans? I’m wondering what would suddenly make a plan selection change a lot that might be a contributing factor.
- natmaka 3y ago> bulk data loads that make table stats more stale This is the usual culprit (cure: "ANALYZE ((tablename))"). Collecting more samples (ALTER TABLE SET STATISTICS...) may be useful. "Extended Statistics" covers most(?) other cases: https://www.postgresql.org/docs/current/planner-stats.html#PLANNER-STATS-EXTENDED https://www.postgresql.org/docs/current/planner-stats.html#P... https://www.postgresql.org/docs/current/multivariate-statistics-examples.html https://www.postgresql.org/docs/current/multivariate-statist...
- pawelduda 3y agoInteresting - how do you approach it when it happens and you're under time pressure to bring it back online - assuming you can't just fix query plan? I'd probably start by tweaking stats options and resetting them for problematic tables but don't have further ideas from the top of my head.