Skip to content
Optimal Lab

Databases · interactive

MVCC: readers don't block writers

Postgres never overwrites a row in place. An update writes a new version, and each transaction reads the versions that were committed when it started. That's how a long report and a busy checkout can run on the same table without waiting for each other.

Versions of one row (accounts.balance)

balancexmin (created by)xmax (replaced by)status
5090—current

The row: balance = 50, created by transaction 90.

step 1 of 7
  1. 1

    When it starts, a transaction notes which transactions have committed. That list decides what it can see.

    T100's snapshot includes 90, not 101.

  2. 2

  3. 3

  4. 4

In production

Tools and technologies

Postgres, MySQL InnoDB and Oracle all use multi-version concurrency control.

Not tied to one language — use these names when you search docs or design a system.