I have two transactions T and U which are executed simultaneously in a DB. How does one provide an example of the lost update problem?
We can assume that we have three accounts A,B,C and they each have £100,£200 and £300 respectively.
concurrency
I have two transactions T and U which are executed simultaneously in a DB. How does one provide an example of the lost update problem?
We can assume that we have three accounts A,B,C and they each have £100,£200 and £300 respectively.
Best Answer
The "lost update" problem relates to concurrent reads and updates to data, in a system where readers do not block writers. It is not necessary for the transactions to be exactly simultaneous.
In this scenario, because Session #1 does not know that another session has already modified the account, the update by Session #2 is overwritten ("lost").
There are several ways to solve this, e.g. version numbers or before-and-after compares.