Reading Complex Query Plans
- Plan literacy. Masters read plans bottom-up: the deepest nodes feed the joins above, and the worst estimate is the story.
- Estimate versus actual. The bug is where estimated and actual rows diverge by orders of magnitude: everything above it chose wrong.
- Plan stability. Plans flip when data grows: production safety means watching for regressions, not tuning once and hoping.
Correctness Under Concurrency
- Race conditions in SQL. Check-then-write races: two requests both read “available” and both book it: concurrency is a correctness topic.
- Atomic patterns. The fixes are atomic: single-statement updates with conditions, SELECT FOR UPDATE, or serializable retries.
- Constraints as backstop. Whatever the code does, a unique constraint makes the double-booking physically impossible: belt and braces.
Designing and Improving Production SQL
- Schema evolution. Production schemas change by migration: versioned, reversible steps that deploy without locking the world.
- Reviewing SQL. Review queries like code: correctness under NULLs, fan-out, plan shape, and what happens at ten times the data.
- Explaining the design. Mastery is defending the model: why these tables, these keys, these indexes: and the trade-offs each one bought.
Before and after this level
- Before: Level 14: SQL Performance: Query Optimisation, Index and Schema Trade-Offs, Production Database Performance.
- Next: this is the last level. The course ends with its projects; see the course outline.
In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.
Frequently asked questions
What does SQL Level 15: SQL Mastery cover?
Reading Complex Query Plans, Correctness Under Concurrency, Designing and Improving Production SQL: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 14: SQL Performance, which covers Query Optimisation, Index and Schema Trade-Offs, Production Database Performance.