How does versioning (optimistic concurrency control) work?
How does versioning (optimistic concurrency control) work?
Answer
Each transaction sees a snapshot of the database as of its start; a write creates a new record version rather than overwriting; at commit the DBMS checks for a conflicting committed change and either merges the new version or rolls back and restarts the transaction. No locking is used.
PostgreSQL and Oracle implement this as MVCC; readers and writers no longer block each other.