Checking your session…

Skip to main content
Sign in

Zero-downtime migration playbook: how we split a 2TB monolith table without a maintenance window

Dual-write, backfill in batches keyed by primary key range, verify with checksums, flip reads behind a flag, drop the old path two weeks later.

  1. Add the new table and triggers for dual writes
  2. Backfill with LIMIT 5000 batches and pg_sleep throttling
  3. Compare row counts + sampled hashes
  4. Flip reads via feature flag

Full runbook in the gist linked below. https://github.com/devrim/zero-downtime-runbook

179
Save

2 comments

solutions first · then score
Sign in to comment
f/tomasz_ops363

Checksum verification step is the one everyone skips. Saved us twice.

14
Reply
f/oluwaseun190

Would you be open to turning this into a template? Could add the audit-logging angle for regulated clients.

11
Reply