Skip to content
Theory · Locks · lesson 3 of 11

The lock queue

In the previous lesson we saw that ALTER TABLE takes ACCESS EXCLUSIVE. Here is what it looks like in real life. In the evening a migration goes out: an empty note column is added to the orders table. The statement itself takes milliseconds, yet for five minutes the chain's site can't open any orders. Interviewers like to ask why a migration "took production down".

In this lesson

  • How the queue forms
  • A wait limit: lock_timeout
  • Who holds whom
  • Common mistake
  • Key points