A payment commits, the API returns 200, the rack loses power, and after recovery the row does not exist. Before blaming the database, six questions have to be separated.
“We sold 3 tickets but only had 1.” The code is inside a transaction, looks right, works a hundred times locally, and only breaks in production under load.
Every list endpoint ends in LIMIT 20 OFFSET ?. It has an index, page one returns in 8ms, and it passes review — then one Tuesday page 4,000 takes four seconds and a nightly export job stops finishing.
A plain-English walkthrough: how B-tree inserts actually work, what a page split costs, why random UUID v4 keys bloat the index by 2× and blow the buffer pool.
Why DELETE is the most expensive DML operation in a relational database — and why a simple UPDATE SET deleted_at = NOW() is 4-8x faster under concurrent load.
A deep-dive into non-SARGable SQL with B-tree diagrams, real EXPLAIN output, and the exact rewrites — told through a gaming dashboard that went from 4,200ms to 2ms without touching the schema.