Learning Pathway
03 — Operations: Zero-Downtime Deployments
7 lessons- 01 DDL Locking: Why ALTER TABLE Can Freeze Your App How DDL locking works: the ACCESS EXCLUSIVE lock most ALTER TABLE takes, the lock queue that blocks reads, and lock_timeout as a safety valve.
- 02 Adding Columns and Constraints Without Downtime Zero-downtime patterns for schema changes: fast default columns, NOT VALID constraints with later VALIDATE, and splitting NOT NULL into safe steps.
- 03 CREATE INDEX CONCURRENTLY: Building Indexes Online How CREATE INDEX CONCURRENTLY works: the two table scans, why it waits for old transactions, handling INVALID indexes, and REINDEX CONCURRENTLY.
- 04 Expand/Contract: The Pattern Behind Every Safe Migration The expand/contract (parallel-change) pattern for zero-downtime schema evolution: add the new shape, dual-write, backfill, switch reads, then remove the old shape.
- 05 Batched Backfills: Updating Millions of Rows Safely Why a single huge UPDATE is dangerous and how to backfill in batches: keyset chunking, commit per batch, throttling, and avoiding long-held locks and…
- 06 Blue/Green and Logical Replication Upgrades How to perform major-version upgrades with near-zero downtime using logical replication: building a green standby, syncing, validating, and cutting over.
- 07 Online VACUUM, REINDEX, and Table Rewrites How to reclaim space and rebuild objects without downtime: VACUUM vs VACUUM FULL, REINDEX CONCURRENTLY, pg_repack, and choosing the right tool.