The Database That Won’t Answer

The queries waiting on each other, drawn side by side with the engine’s own split-second holds. This lesson is what you do when one of those queues has frozen a real app and nobody yet knows which one.
Before you start. The last seven lessons opened one database a layer at a time: a table is a pile of 8 KB pages (Pages & Heap Files), an index is a sorted tree that finds a row in a few page reads (B-Tree on Disk), an update leaves the old row behind for vacuum to sweep up (MVCC & Vacuum), the planner bets on a plan from a small summary of each table (The Query Planner), and a lock makes one query wait for another’s whole transaction (Locks, Latches & Transactions). This lesson uses all of it at once, to work out which of those parts has gone wrong when a database gets sick.