Skip to content
Theory · Locks · lesson 1 of 11

Table locks

SELECT and UPDATE hold the ledger; ALTER waits in line for it to be free, and a new reader waits behind ALTER

Let's go back to the coffee chain's office. The ledgers are kept in the archive, and clerks come to its window for them. On every ledger handed out, the archive keeper hangs a tag: "reading", "adding lines", "rebinding". Five clerks can read one ledger at once, and adding lines works the same way. But a binder needs nobody to hold the ledger at all.

In this lesson

  • Eight modes
  • The rules in plain words
  • Locks in pg_locks
  • Common mistake
  • Key points