recall

← recall

optimistic locking term

check version on update, retry if changed

No lock taken. Read with version, modify, write back with 'WHERE version = X'. If another tx changed it, your update affects 0 rows and you retry. Cheap when contention is low. Hibernate's @Version, Postgres SELECT ... FOR NO KEY UPDATE patterns.

topics: concurrency, locks, databases

references: