Many Versions of a Row
Under multiversion concurrency control an update does not overwrite a row in place. It creates a new version and keeps the old one visible to transactions that started earlier. Readers never block writers and writers never block readers.
Visibility Metadata
Each row version carries hidden columns:
- xmin, the id of the transaction that created the version.
- xmax, the id of the transaction that deleted or superseded it.
A transaction takes a snapshot at start, recording which transaction ids are committed, in progress, or future. A version is visible if its xmin is committed in the snapshot and its xmax is not.
Reading Consistently
Because the snapshot is fixed, the transaction sees the same data throughout, even as others commit changes. Old versions remain until no snapshot can see them, after which cleanup reclaims them.
Key idea
MVCC keeps multiple row versions stamped with xmin and xmax, and a per transaction snapshot decides which versions are visible so readers and writers do not block each other.