Search CTRL + K

Multiversion Concurrency Control

多版本并发控制 是优化读多于写的数据库并发控制策略,它不属于 悲观并发控制乐观并发控制,而可以和这两者的方案结合使用。

多版本并发控制 中,每一次写都会创建一个新的版本数据,而读操作会从有限多个版本中选择最合适的版本返回,这样读写冲突就规避了,这个算法的核心在于管理和快速挑选数据版本。


Wikipedia

Multiversion concurrency control (MCC or MVCC), is a concurrency control method commonly used by database management systems to provide concurrent access to the database and in programming languages to implement transactional memory.[1]

Database System Concepts

The concurrency-control schemes discussed thus far ensure serializability by either delaying an operation or aborting the transaction that issued the operation. For example, a read operation may be delayed because the appropriate value has not been written yet; or it may be rejected (that is, the issuing transaction must be aborted) because the value that it was supposed to read has already been overwritten. These difficulties could be avoided if old copies of each data item were kept in a system.

In multiversion concurrency-control schemes, each write(Q) operation creates a new version of Q. When a transaction issues a read(Q) operation, the concurrency control manager selects one of the versions of Q to be read. The concurrency-control scheme must ensure that the version to be read is selected in a manner that ensures serializability. It is also crucial, for performance reasons, that a transaction be able to determine easily and quickly which version of the data item should be read.[2]


  1. https://en.wikipedia.org/wiki/Multiversion_concurrency_control ↩︎

  2. Silberschatz, Abraham, Henry F. Korth, and S. Sudarshan. Database System Concepts. Seventh edition. New York, NY: McGraw-Hill, 2020. ↩︎