Systems & Backend

MVCC

also: multi-version concurrency control

Multi-Version Concurrency Control: readers see a consistent snapshot while writers create new versions — so reads do not block writes.

MVCC (Multi-Version Concurrency Control) lets a database serve concurrent reads and writes without blocking each other by keeping multiple versions of a row. A reader sees a consistent snapshot as of when its transaction started, while writers create new versions rather than overwriting in place.

Worked example: in Postgres, a long analytics query reads the row versions visible at its start even as other transactions update those rows — no read locks, no blocking. Gotcha: old versions must be cleaned up (Postgres calls it VACUUM) or they accumulate as “bloat,” and long-running transactions hold back that cleanup — which is why a forgotten open transaction can silently balloon your database size and slow everything down.