MVCC

John Pradeep Vincent
4 min readFeb 19, 2020

MVCC (multi-version concurrency control) is a concurrency control mechanism used to provide consistency and isolation attributes (as defined in ACID) for shared data.

The aim of this blog is to give a very high-level understanding of MVCC, without going too much into any specific implementation details.

Lock based concurrency control

When you have multiple concurrent processes (or transactions) operating on a set of shared data, one way to provide consistency & isolation is by using “locks”.

But locks are expensive because when a process locks the data set for reading/writing, all other processes wanting to get access to the same data set will be blocked until the lock is released, which reduces the throughput of your system.

In the lock-based approach, a concurrent process takes the below steps to safely mutate the shared data.

  1. obtain the locks to the shared data
  2. perform some computations
  3. update the data elements
  4. release the locks

As you can see, when the process A acquires all the locks and starts performing the computations, process B has to wait till the process A releases the lock, which is a problem.

--

--