Multiversion concurrency control
|
In computer science, in the field of databases, multiversion concurrency control (abbreviated MCC or MVCC) is a concurrency control method used in relational databases.
MCC uses timestamps or increasing transaction IDs to achieve serializability. MCC ensures a transaction never has to wait for a database object and to maintain several versions of an object. Each version would have a write timestamp and it would let a transaction Ti read the most recent version of an object which precedes timestamp TS(Ti).
If Ti wants to write to an object, and if there was another transaction Tj, the timestamp order must be TS(Ti) < TS(Tj) for the object write to succeed.
Every object would also have a read timestamp, and if Ti wanted to write to object P, and TS(Ti) < RTS(P), Ti is aborted and restarted. Otherwise, Ti creates a new version of P and sets the read/write timestamps of P to TS(Ti).
The obvious drawback to this system is the cost amount of many versions of many objects in the database (sort of like Wikipedia). On the other hand, reads are never blocked which can be important for workloads who mostly read values from the database.