Skip to content
Ameen Abozaid
Planned lessonMID-020-L01

Why migrations cause outages

  • Lesson 1 of 6
  • Mid-level
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 TABLE forms take an ACCESS EXCLUSIVE lock, 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.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.