Backend concept

Schema Migrations

Expand-contract releases, backfills, dual writes, rollback safety, and zero-downtime database changes.

Practice this concept Review missed items Back to concept map

Why this matters

Production schemas change while old and new application versions may run at the same time.

How to practice

Plan safe migration order before adding constraints or removing old columns.

0 active misses 0 reviewed 0 games completed

Local review for this concept

No local review items for this concept yet.

Start a focused review session for Schema Migrations.

Learning objectives

  • Apply expand-contract thinking to columns, renames, indexes, and constraints.
  • Plan backfills that avoid unnecessary locks and production load spikes.
  • Explain why schema changes must be compatible with mixed application versions.
  • Choose indexes that match filters and ordering.
  • Apply the leftmost prefix rule for composite indexes.
  • Recognize when an index is low-value or creates unnecessary write overhead.

Common mistakes to avoid

  • Renaming or dropping a column while old app versions still use it.
  • Running huge backfills or index builds in the most blocking mode during peak traffic.
  • Adding constraints before all writers and old rows satisfy them.
  • Treating rollback as simple even after destructive schema changes.
  • Indexing a low-cardinality boolean column by itself and expecting a large speedup.
  • Creating composite indexes in the wrong column order.

Games for Schema Migrations

Start with the first game, then use local review history to revisit missed decisions.

Databases Intermediate

Schema Migration Runbook

Choose safe zero-downtime database migration steps for expanding schemas, backfilling data, rolling out indexes, enforcing constraints, and recovering from failures.

Time
6-9 minutes
Concept
Zero-downtime schema migration planning and expand-contract releases
  • Data & Performance
  • migrations
  • schema design
  • backfill
Play Schema Migration Runbook
Databases Intermediate

SQL Index Quest

Choose the best database index for simplified schemas and queries while learning full scans, covering indexes, sort avoidance, and composite order.

Time
7-10 minutes
Concept
Database indexing and query performance
  • Data & Performance
  • SQL
  • indexes
  • performance
Play SQL Index Quest
Databases Advanced

Transaction Isolation Arena

Defend database invariants from concurrent requests by choosing transactions, locks, constraints, snapshot reads, and optimistic concurrency.

Time
7-10 minutes
Concept
Database transactions, isolation anomalies, locks, and invariant protection
  • Data & Performance
  • SQL
  • transactions
  • isolation
Play Transaction Isolation Arena