What is MVCC (Multi-Version Concurrency Control) in MySQL?

Answer

MVCC (Multi-Version Concurrency Control) is InnoDB's mechanism for providing consistent reads without acquiring read locks, enabling high concurrency. Instead of locking rows for reads, InnoDB maintains multiple versions of each row. When a transaction reads a row, it sees the version that was committed as of the transaction's start time — not necessarily the current version. How it works: every InnoDB row has two hidden columns: DB_TRX_ID (ID of the transaction that last modified the row) and DB_ROLL_PTR (pointer to the undo log entry). When a row is updated, the old version is moved to the undo log, and the new version is written with the current transaction ID. A reader finds the version visible to its snapshot by following the undo log chain. This means: readers don't block writers, and writers don't block readers — massive concurrency improvement. The consistent snapshot is taken at the START of a REPEATABLE READ transaction (or at the start of each statement in READ COMMITTED). Undo logs are purged by the InnoDB purge thread when no transaction needs them. Large, long-running transactions prevent purge, causing the undo log (and ibdata1) to grow unboundedly — a common production issue.