Why migrations cause outages
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
see how a schema change can block production.
Planned topics
- Many
ALTER TABLEforms take anACCESS EXCLUSIVElock, which blocks all reads and writes on the table. - A waiting DDL statement also blocks later queries queued behind it, so one slow transaction can cause a pile-up.
- Table rewrites (changing a column type, some defaults on older versions) hold the lock while copying data.
- Old and new application versions run together during a deploy, so the schema must work for both.
Draft outline details
Demonstration
a timeline: a long transaction holds a lock, ALTER TABLE waits, new queries queue behind the ALTER, and the API times out.
Check your understanding
Why does a waiting ALTER TABLE hurt even before it runs?
Show answer
It queues in the lock queue and blocks everything behind it.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.