Eight tracks
Each one is prose with a live database beside it. Every claim a lesson makes is a statement you can run against a forty-one-million-row table with a workload going through it.
Locks
0/2What is waiting behind your migration?
The eight lock levels and what conflicts with what, the queue they wait in, and head-of-line blocking watched as it happens. Ends with
lock_timeout, which belongs at the top of every migration you will ever write.Rewrite or metadata
0/2Is this statement copying every row?
Constant defaults against volatile ones, type changes,
NOT NULLand its two-step form, and what a full-table rewrite does to replication lag. The single most valuable distinction in the whole subject.Indexes
0/1How do you build one without stopping writes?
CONCURRENTLYand what it costs, invalid indexes and how to clean them up, unique indexes on live data, and dropping the index nobody uses.Constraints
0/1How do you add a rule to a table already full of rows?
NOT VALIDthenVALIDATE, foreign keys on large tables and the lock they take on both sides, and check constraints as the cheap alternative to a type change.Expand and contract
0/1How do you change a column the running code still reads?
Adding beside, dual writes, backfill, switch, drop — and why a rename is five migrations rather than one. Views as a shim when the old name has to keep working.
Backfills
0/1How do you touch ten million rows without anybody noticing?
Batch size and what decides it, sleeping between batches, writing a backfill you can safely run twice, and watching p99 while it runs.
Schemaless drift
0/1Where does the schema go when there isn't one?
Versioned documents, keeping a reader for every version still in the store, backfill as a batch job, and deciding when a version is finally safe to stop supporting.
Reading a generated migration
Lands in a later milestoneWhat will this do to production?
The track the rest exists for. You are handed the migration file an agent wrote for a stated change and a production-sized table, and asked what it locks, for how long, whether it rewrites, and what the old code does mid-migration. Then you run it and watch.
It lives at /audit
9 lessons built so far. The rest land with their milestones.