jargon

Backend & systems·Concurrency and coordination

you read the row with its version, write it back only if the version has not changed, and retry the whole thing if it has.

Optimistic locking

Also calledoptimistic concurrency control, version column

Detecting conflicts at write time by checking that the record has not changed since you read it, usually via a version or timestamp column. There is no lock held, so readers never block and there is no deadlock risk. It works well when conflicts are rare, and degrades badly on hot rows where retries pile up.

Commonly confused with