Databases
Advanced
What is MVCC (Multi-Version Concurrency Control)?
A technique where the database maintains multiple versions of data to allow concurrent reads and writes without locking.
MVCC enables high concurrency by letting readers see a consistent snapshot of data without blocking writers. When a row is updated, the database creates a new version rather than overwriting the old one. Readers see the version that was current when their transaction started. PostgreSQL implements MVCC by storing version information (xmin/xmax transaction IDs) with each tuple. This eliminates read-write contention but requires periodic VACUUM to reclaim space from obsolete row versions. MVCC is why PostgreSQL can handle many concurrent users efficiently.