0PricingLogin
SQL Academy · Lesson

Zero-Downtime Column Renames

Add new column, dual-write, backfill, switch reads, drop the old — the canonical zero-downtime rename pattern.

The Naive Approach Breaks

ALTER TABLE t RENAME COLUMN a TO b; is metadata-only — fast. BUT the app expects column "a"; after the rename, every query reading "a" breaks.

Strategy: Expand → Migrate → Contract

The canonical zero-downtime pattern:

  1. Expand — add the new column without removing the old
  2. Have the app write to both for a while
  3. Migrate — backfill historical data into the new column
  4. Switch reads to the new column
  5. Contract — drop the old column

All lessons in this course

  1. Online Migrations: Why ALTER TABLE Locks
  2. Concurrent Indexes (CREATE INDEX CONCURRENTLY)
  3. Zero-Downtime Column Renames
  4. Tools: Flyway, Liquibase, Sqitch
← Back to SQL Academy