Runbook category

Query performance

Open this category when the ticket says "the database is slow" and the evidence is really one statement: a latency histogram spike, an EXPLAIN that looks wrong, or a single query owning CPU while the rest of the cluster is idle. These runbooks start from the plan rather than from a timer, what the planner chose, what it expected, and what it actually got.

The failure modes here are plan-shaped. A sequential scan that should have been an index, a nested loop on a bad row estimate, a lossy bitmap that rechecks half the table, a CTE that materialised a fence you never asked for, a sort or hash that spilled to disk, parallel workers that never started, or a prepared statement stuck on a generic plan. The fixes range from an index or a statistics object to a work_mem change to leaving the plan alone because the sequential scan was right.

If you do not yet have a plan or a statement id, start in Observability and come back with one. If the plan is fine and the heap is huge with dead tuples, you want Vacuum & bloat. If the symptom is "this session just stopped" with no slow query at the top of pg_stat_statements, you want Locking & concurrency. Indexing is the structural half of many of these fixes; this category is the diagnostic half that tells you whether an index is even the answer.