A practical guide to PostgreSQL EXPLAIN ANALYZE: what the cost, rows, loops and buffers numbers mean, the plan nodes you will meet most, a worked example that turns a sequential scan and sort into a fast index scan, fixing bad row estimates with statistics, and finding and logging slow plans in production with pg_stat_statements and auto_explain.