Skip to content

Two people spend the same balance

Two requests run at the same moment, each in its own transaction at READ COMMITTED:

read balance (100) → subtract 80 in application code → write 20

Both read 100. Both write 20. One withdrawal of 80 has vanished.

What is the correct fix?