Databases that automatically detect lost updates simplify application code


Last Updated on Feb 17, 2021

An alternative to atomic operations and locks is to allow updates to happen concurrently and abort the second transaction if the transaction manager detects a lost update. The aborted transaction can then safely retry its Read-Modify-Write cycle.

Databases that support Snapshot Isolation can perform this check easily. PostgreSQL's repeatable read, Oracle's serializable, and SQL Server's snapshot isolation levels automatically detect lost updates and abort the offending transaction.

Lost update detection is a useful database feature because it eliminates the need to deal with locks or atomic operations within the application. Bugs that could be introduced (because one forgot to use a lock or atomic operation) are automatically eliminated.


© 2022 Ambitious Systems. All Rights Reserved.