Section 2 of 3 · 7 minutes
Rehearse the exact rollout and rollback
Your goal
What you will be able to do
Test the production-shaped procedure with realistic data, timing, locks, WAL, and application behaviour.
Why this matters at work
The practical reason
A command that succeeds on an empty test database may block or fill storage on production data.
Learn
The idea in plain English
Use production-shaped volume and PostgreSQL versions. Measure locks, elapsed time, temporary space, WAL, replica effects, and application compatibility.
Write the rollback procedure and rehearse it too. Some schema and data changes are not safely reversible; use expand-and-contract compatibility or forward repair instead of promising a false rollback.
Remember these points
- Test with realistic volume and concurrency.
- Measure WAL, locks, storage, replicas, and application behaviour.
- Prove rollback, or state clearly when only forward recovery is safe.
See it in SQL
Inspect locks held during a rehearsal
See the lock modes a test migration takes on its target relation.
SELECT
locktype,
mode,
granted,
pid
FROM pg_locks
WHERE relation = 'training_orders'::regclass
ORDER BY granted, mode, pid;Run this from a second session while the rehearsal is active. The result shows granted and waiting locks.
Translate the lock mode into application impact and include it in the maintenance decision.
Current granted and waiting lock modes associated with the training_orders relation.
Useful words
Important terms
- Expand and contract
- A staged compatibility pattern that adds the new shape before removing the old one.
Quick check · Not graded
Check your understanding
Why must a migration rehearsal use realistic data volume?
Your progress is saved to your signed-in account.