Postgres Performance Tuning: The First Five Things I Check
When somebody hands me a Postgres database and says “it’s slow,” I work through the same checklist almost every time. None of these are exotic. They’re the boring, high-leverage things that solve maybe 80 percent of the cases I see before anyone has to think hard. 1. EXPLAIN (ANALYZE, BUFFERS) before anything else Theories about why a query is slow are mostly worthless. Run the query with EXPLAIN (ANALYZE, BUFFERS) and read the output. ...