SyntaxStudy
Sign Up
MySQL MVCC (Multi-Version Concurrency Control)
MySQL Advanced 5 min read

MVCC (Multi-Version Concurrency Control)

MVCC

InnoDB uses MVCC to allow consistent reads without blocking. Each transaction sees a snapshot of the data from when it started.

Example
-- Session 1                        -- Session 2
START TRANSACTION;                 START TRANSACTION;
-- Sees snapshot from T1 start     SELECT balance FROM accounts WHERE id=1;
                                   -- Returns 1000 (snapshot)
UPDATE accounts SET balance=500    -- Session 2 still sees 1000
  WHERE id=1;
COMMIT;                            SELECT balance FROM accounts WHERE id=1;
                                   -- Still sees 1000 (REPEATABLE READ)
                                   COMMIT;  -- Now next read sees 500
Pro Tip

MVCC means readers never block writers and writers never block readers — high concurrency.