Problem Statement
Optimistic concurrency control typically relies on what?
Explanation
Optimistic control assumes conflicts are rare. It reads without locks and, at update, verifies the row version or timestamp has not changed. If changed, it retries or errors.
This reduces lock contention but needs careful retry logic in the application.
Code Solution
SolutionRead Only
UPDATE t SET val=:v, version=version+1 WHERE id=:id AND version=:expected;
Practice Sets
This question appears in the following practice sets:
