How a database stays correct, in 3 small steps · part 1 of 3 · Transactions: interleaving, lost update and locks
Two people book the last seat at once. Who gets it?
Asha and Ben tap Book on the last concert seat at the same moment, and both get a ticket. Each booking is a transaction: read, check, write. When the steps interleave, one write covers the other, a lost update. An exclusive lock on the row makes Ben wait, and he sees Sold out.
What you turn: Lock on the row
The reel
Watch it on InstagramThe full lesson · 7:19
The long version
The same idea, slower: more examples, and pauses to try each step yourself.