Skip to content
Theory · Locks · lesson 7 of 11

Deadlocks, NOWAIT and SKIP LOCKED

When a row is taken, a transaction waits. Usually the wait ends by itself: the holder commits, and the row is free. But sometimes two transactions wait for each other, and then the wait never ends.

In this lesson

  • How a deadlock happens
  • How PostgreSQL finds it
  • The cure: one order
  • Not waiting: NOWAIT and SKIP LOCKED
  • Common mistake
  • Key points