0% completed
MVCC is a concurrency control mechanism used in databases to allow multiple transactions to operate on the same data simultaneously by maintaining multiple versions of data items. Instead of locking rows, MVCC creates a new version of a row whenever a write occurs, ensuring that:
Data Versioning:
created_by
: The transaction that created the version.deleted_by
: The transaction that invalidated or deleted the version.Snapshot Isolation:
Conflict Resolution:
In the image below, data versions are created as transactions modify balances in two accounts.
The database starts with two accounts:
Each account has a version associated with it, created by the transaction that initialized the data. Both accounts currently have no deleted versions.
Version Creation:
deleted_by
field indicates which transaction invalidated the previous version.Consistent Snapshots:
No Locks:
.....
.....
.....