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.
- Add the new table and triggers for dual writes
- Backfill with
LIMIT 5000batches andpg_sleepthrottling - Compare row counts + sampled hashes
- Flip reads via feature flag
Full runbook in the gist linked below. https://github.com/devrim/zero-downtime-runbook
2 comments
solutions first · then score