DataMVCCmulti-version concurrency controlrow versioning

MVCC (multi-version concurrency control)

Definition

MVCC stores a new row version for every update, tagged with the transaction that created it, and each transaction reads the versions visible in its snapshot.

In practice

Because readers look at old versions instead of waiting, reads never block writes and writes never block reads. This is how Postgres, MySQL InnoDB, Oracle and most modern databases implement READ COMMITTED and snapshot isolation; only writers to the same row still wait on each other's locks.

Old versions must be cleaned up once no snapshot needs them: vacuum in Postgres, purge of the undo log in InnoDB. A long-running transaction or forgotten idle in transaction session pins old versions, so tables bloat and queries slow down. MVCC alone also does not prevent lost updates or write skew.

Example

While a 10-minute report reads the orders table, 50,000 updates create new row versions; the report keeps seeing the data as of its start, and vacuum can only reclaim the old versions after it finishes.