Order the steps
Order the steps for diagnosing a query that became slow after a data import.
- Run
ANALYZEon the imported table and re-check the plan - Find it in
pg_stat_statementsby total time - Compare estimated vs actual rows node by node
- Run
EXPLAIN (ANALYZE, BUFFERS)inside BEGIN ... ROLLBACK
Choose an answer, then open Show answer below to check it.
Show answer
Answer: B D C A
- Find it in
pg_stat_statementsby total time Pick the query that costs the most overall. - Run
EXPLAIN (ANALYZE, BUFFERS)inside BEGIN ... ROLLBACK Real timings without keeping side effects. - Compare estimated vs actual rows node by node A big gap points at stale or missing statistics.
- Run
ANALYZEon the imported table and re-check the plan Bulk imports often leave statistics stale until autovacuum catches up.