Optimistic Locking
A concurrency strategy that allows work to proceed without holding a long-lived lock and detects conflicting updates at commit or write time.
Database Context
Optimistic locking lets work proceed without holding a long-lived lock and detects interference when a write is attempted. A version column or compare-and-set style WHERE clause can make an update affect zero rows when another transaction has changed the record, allowing the application to handle the conflict explicitly.
Transaction Boundary
Optimistic locking does not replace database isolation. An invariant spanning several rows, predicates, or external resources still requires appropriate transaction semantics and conflict handling.
Related Database Concepts
- Lost Update
- Compare-and-Swap
- Transaction
- Version Column