Postgres schema migrations using the expand/contract pattern
summary
Shows how the expand/contract pattern performs zero‑downtime Postgres migrations by keeping old and new schema live simultaneously, using pgroll to automate the two‑phase start/complete flow. Migrations are expressed as JSON, pgroll creates per‑version schema views and installs triggers for dual‑write so application V1 and V2 see different projections of the same table while a batched backfill runs. Tool is Postgres‑specific, open source (Apache), aims to avoid long exclusive locks and make rollbacks safer by removing added objects during contract.
AI-written summary · about
chapters (8)
- 0:00Introduction and context
- 4:30Common migration pitfalls
- 11:13Tools and techniques
- 14:22Expand contract pattern
- 21:41Introducing pgroll
- 25:19Demonstration
- 35:33Lessons and takeaways
- 38:00Q&A
related talks
38mPostgreSQL pgroll: Zero-Downtime, Reversible Migrations
30mExpand Contract Pattern for Continuous Delivery of Databases
37mDatabase Schema Migrations with Zero Downtime
52mManaging PostgreSQL changes for the Agile DBA
19mExpand Contract Pattern for Continuous Delivery of Databases
28mBringing PostgreSQL towards zero downtime migration with Python
48mMigrating to PostgreSQL: Strategies, Sovereignty, and Success
34mPartitioning and Data Migrations Using PostgreSQL as an Example
