Stale PostgreSQL statistics make queries 580x slower after backfill
Stale PostgreSQL statistics can cause the query planner to choose inefficient execution plans, turning fast index lookups into costly sequential reads. In a test case involving five million orders, a backfilled status update left unanalyzed by autovacuum caused a query to run 580 times slower. Running a manual ANALYZE or adjusting the autovacuum scale factor restored optimal performance. Open article →