Skip to content
Theory · Transactions · lesson 7 of 11

Locks and FOR UPDATE

If in the lost-update widget T2 wrote before T1 committed, its UPDATE waited. A lock made it wait. In this lesson we'll see what a lock does and how it helps you not to lose updates.

In this lesson

  • UPDATE locks the row
  • Changing from the current value
  • SELECT … FOR UPDATE
  • Common mistake
  • Key points