Chapter 22 — Further Reading

Migration tools (💻 Developer · 🏗️ DBA)

Zero-downtime & safe migrations (🏗️ DBA · 💻 Developer)

  • "Zero-downtime migrations in PostgreSQL" / "Safe database migrations" guides — the canonical expand-contract treatment (Case Study 1) and the safe-ALTER techniques.
  • pgroll, reshape, and similar tools — automate expand-contract for PostgreSQL.
  • "Common DB schema change mistakes" / strong_migrations (Rails) docs — a great checklist of dangerous operations and their safe alternatives (Case Study 2's review checklist, essentially).
  • PostgreSQL Docs: "Explicit Locking" and "ALTER TABLE" — which operations take which locks (the root of the lock-heavy dangers).

Data migrations & batching (🏗️ DBA)

  • "Deleting/updating millions of rows without downtime" — batching strategies, lock and WAL considerations (ties to Chapters 14, 27, 28).
  • lock_timeout / statement_timeout docs — failing fast instead of freezing the app.

Practice & philosophy (everyone)

  • "Database migrations done right" essays — versioning, review, testing on prod-like data, rollback planning.
  • Infrastructure-as-code for databases — treating schema as versioned code alongside the app.

Reference (this book)

  • Chapter 14 — Data Definition: the ALTER/lock mechanics this chapter operationalizes.
  • Chapter 38 — Database Administration: backups/PITR — the rollback of last resort.
  • Chapter 30 — ORMs: Alembic and model-driven migrations.

Do, don't just read

  • Turn Mercado's schema.sql into ordered migrations with up/down files.
  • Plan and write an expand-contract change (rename or split a column) end to end.
  • Write a batched, re-runnable backfill and test it on the generate_data.sql dataset to feel the difference batching makes at scale.

Next: Chapter 23 — Indexing — Part IV begins: making queries fast.