-
Notifications
You must be signed in to change notification settings - Fork 0
postgres
The lost update anomaly occurs when two transactions read the same table row, then one
of the transactions updates this row, and finally the other transaction updates the same
row without taking into account any changes made by the first transaction.
Suppose that two transactions are going to increase the balance of the same account by
The dirty read anomaly occurs when a transaction reads uncommitted changes made by another transaction. For example, the first transaction transfers $��� to an empty account but does not commit this change. Another transaction reads the account state (which has been updated but not committed) and allows the customer to withdraw the money—even though the first transaction gets interrupted and its changes are rolled back, so the account is empty. The standard allows dirty reads at the Read Uncommitted level.
The non-repeatable read anomaly occurs when a transaction reads the same row twice,
whereas another transaction updates (or deletes) this row between these reads and commits the change. Consequently, the first transaction gets different results.
For example, suppose there is a consistency rule that forbids having a negative balance in
bank accounts. The first transaction is going to reduce the account balance by