Zero-Downtime PostgreSQL Migrations in Production
How to change a live PostgreSQL schema without taking the app down: the expand-and-contract pattern, online DDL with CONCURRENTLY and NOT VALID, batched backfills, and the lock monitoring that lets you do it with confidence.
Plan every change as expand, migrate, then contract
CriticalSet lock_timeout on every migration so a stuck DDL fails fast
CriticalAdd columns without rewriting the whole table
Build indexes with CREATE INDEX CONCURRENTLY
CriticalAdd NOT NULL with a CHECK constraint, not in one shot
CriticalAdd foreign keys in two steps with NOT VALID
Change a column type by adding a new column, not ALTER TYPE
Backfill data in small batches, never one big UPDATE
CriticalMake the app write both old and new shapes during the switch
CriticalNever rename a live column or table in place
Drop columns and tables only after nothing reads them
CriticalUse a migration tool that can run statements outside a transaction
Rehearse the migration on a production-sized copy and time the locks
Watch locks and blocking queries while the migration runs
CriticalWatch replication lag and dead tuples during big backfills
More checklists
Cloud
AWS Well-Architected Review Checklist
Comprehensive checklist based on AWS Well-Architected Framework covering operational excellence, security, reliability, performance efficiency, cost optimization, and sustainability.
120-180 minutes
Infrastructure
High Availability Architecture Checklist
Comprehensive checklist for designing and implementing highly available systems with load balancing, failover, and redundancy.
90-120 minutes
Platform Engineering
Building an Internal Developer Platform from Scratch
A step-by-step checklist for designing and building an internal developer platform (IDP) that gives your engineers self-service access to infrastructure, environments, and deployments without filing tickets.
60-120 minutes
Also worth your time on this topic
Zero-Downtime Database Migrations for PostgreSQL in Production
A single ALTER TABLE can take down a busy PostgreSQL database for minutes. This post shows why that happens and how to ship schema changes safely with lock timeouts, the expand-and-contract pattern, and copy-paste SQL recipes for indexes, columns, constraints, and type changes.
Blue-Green Deployment Strategy
What is a blue-green deployment, and what are its advantages and disadvantages compared to other deployment strategies?
mid
Zero-Downtime Database Migrations for PostgreSQL
Practical techniques for changing schemas on busy PostgreSQL databases without taking the app down, including expand-and-contract, online DDL, and safe backfills.
22 minutes