InterviewHubPRO
Section Overview
Q36

Question 36 of 50

Part 3: Distributed Transactions, Consensus & Reliability (26 - 36)

72%
System Design (50 Qs)•Part 3: Distributed Transactions, Consensus & Reliability (26 - 36)

Zero-Downtime Database Migrations (Expand and Contract Pattern).

In Simple Words: How to rename columns or alter schemas on live production databases with billions of rows without table locks or service downtime.

  1. Expand: Add new nullable column new_column.
  2. Dual-Write: Deploy application code that reads from old_column and writes to both old_column and new_column.
  3. Backfill: Asynchronously copy legacy data from old_column to new_column in small batches.
  4. Switch Read: Switch application reads to new_column.
  5. Contract: Stop writing to old_column and drop it during a low-traffic window.