Runbook category
Indexing
Indexes are the fix people reach for first and audit last. Half of these runbooks add one — the right type, the right column order, the right subset of rows — and half take one away, because every index is paid for on every write. If you only read one, read the unused-index audit: it is the cheapest win most databases still have sitting there.
- Pro
Index the foreign key you forgot
Deleting one parent row scans the whole child table to check the constraint.
- Pro
Make index-only scans actually skip the heap
Plan says Index Only Scan, Heap Fetches is huge, and it is not fast.
- Pro
Covering indexes with INCLUDE
The index finds rows quickly, then the heap trip for the selected columns costs everything.
- Pro
Partial indexes for hot subsets of data
A multi-megabyte index when queries only ever touch last week's rows.
- Pro
Get the multicolumn index column order right
The composite index exists and the planner still sorts — the columns are the wrong way round.
- Pro
GIN indexes for jsonb containment queries
A jsonb @> filter ignores every B-tree you own and reads every document.
- Pro
BRIN indexes for huge append-only tables
A huge B-tree on a timestamp column whose rows already arrive in order.
- Pro
Eliminate redundant and duplicate indexes
Writes are slow and the same leading column is indexed three different ways.
- Pro
Find and drop unused indexes
An index nobody has scanned in years that every INSERT still pays for.