https://en.wikipedia.org/wiki/Multiversion_concurrency_control

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]

If someone is reading from a database at the same time as someone else is writing to it, it is possible that the reader will see a half-written or inconsistent piece of data. There are several ways of solving this problem, known as concurrency control methods. The simplest way is to make all readers wait until the writer is done, which is known as a lock. This can be very slow, so MVCC takes a different approach: each user connected to the database sees a snapshot of the database at a particular instant in time. Any changes made by a writer will not be seen by other users of the database until the changes have been completed (or, in database terms: until the transaction has been committed.)

When an MVCC database needs to update an item of data, it will not overwrite the old data with new data, but instead marks the old data as obsolete and adds the newer version elsewhere. Thus there are multiple versions stored, but only one is the latest. This allows readers to access the data that was there when they began reading, even if it was modified or deleted part way through by someone else. It also allows the database to avoid the overhead of filling in holes in memory or disk structures but requires (generally) the system to periodically sweep through and delete the old, obsolete data objects. For a document-oriented database it also allows the system to optimize documents by writing entire documents onto contiguous sections of disk—when updated, the entire document can be re-written rather than bits and pieces cut out or maintained in a linked, non-contiguous database structure.

MVCC provides point in time consistent views. Read transactions under MVCC typically use a timestamp or transaction ID to determine what state of the DB to read, and read these versions of the data. Read and write transactions are thus isolated from each other without any need for locking. Writes create a newer version, while concurrent reads access the older version.

Any changes made by a writer will not be seen by other users of the database until the changes have been completed的更多相关文章

  1. ORACLE 主要后台进程1

    Oracle Database Background Processes: 1.Database writer (DBWn)The database writer writes modified bl ...

  2. oracle_hc.sql

    select event,count(1) from gv$session group by event order by 2;exec dbms_workload_repository.create ...

  3. 【恢复,1】 redo 日志恢复的各种情况

    Recovering After the Loss of Online Redo Log Files If a media failure has affected the online redo l ...

  4. Oracle 数据库的组成(instance+database)

    Oracle服务器是一种对象关系数据库管理系统,它为信息管理提供开放.综合.集成的方法. Oracle服务器中有多种进进程.内存结构和文件: Oracle服务器由一个Oracle实例和一个Oracle ...

  5. Oracle 备份与恢复基础

    Oracle 备份与恢复基础 :三思笔记 备份与恢复 A whole database backup is either a consistent backup or an inconsistent ...

  6. COM Error Code(HRESULT)部分摘录

    Return value/code Description 0x00030200 STG_S_CONVERTED The underlying file was converted to compou ...

  7. Spark译文(一)

    Spark Overview(Spark概述) ·Apache Spark是一种快速通用的集群计算系统. ·它提供Java,Scala,Python和R中的高级API,以及支持通用执行图的优化引擎. ...

  8. 使用.NET简单实现一个Redis的高性能克隆版(四、五)

    译者注 该原文是Ayende Rahien大佬业余自己在使用C# 和 .NET构建一个简单.高性能兼容Redis协议的数据库的经历. 首先这个"Redis"是非常简单的实现,但是他 ...

  9. .NET平台开源项目速览(16)C#写PDF文件类库PDF File Writer介绍

    1年前,我在文章:这些.NET开源项目你知道吗?.NET平台开源文档与报表处理组件集合(三)中(第9个项目),给大家推荐了一个开源免费的PDF读写组件 PDFSharp,PDFSharp我2年前就看过 ...

随机推荐

  1. Spring Integration - 自动轮询发送手机短信

    Spring Integration 配置 <?xml version="1.0" encoding="UTF-8"?> <beans xml ...

  2. 疯狂java学习笔记之面向对象(六) - 构造器重载、方法重载和方法重写

    一.方法重载(Overload): Java允许同一个类中定义多个同名方法,只要形参不一样就可以,如果同一个类中包含了两个或两个以上方法名相同的方法,但形参列表不同,则被成为方法重载(两同一异). 同 ...

  3. JavaScript无缝滚动

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  4. NoSql之MongoDB--Ubuntu下安装

    MongoDB只提供了64位LTS(长期支持)Ubuntu发行版的packages.例如,12.04 LTS,14.04 LTS,16.04 LTS等等. 1.导入被包管理系统使用的公钥 Ubuntu ...

  5. Visual Studio蛋疼问题解决

    监视变量显示未定义标识符: VS2012在编译的时候采用了较快的编译模式,所以有些变量就显示未定义了.  解决方案:  项目->属性->c/c++->优化->改为禁用/OD  ...

  6. Shell 脚本

    近期在别人的工作基础上完善了几个shell自动安装脚本. 1. 循环远程访问机器并安装 #!/bin/bash IpPrefix=. User=root Pwd= SMNIP=52.1.123.79 ...

  7. HDU 3072 (强连通分量)

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=3072 题目大意:为一个有向连通图加边.使得整个图全连通,有重边出现. 解题思路: 先用Tarjan把 ...

  8. iOS中为网站添加图标到主屏幕

    1 <link rel="apple-touch-icon-precomposed" href="icon.png"/> 2 <link re ...

  9. OpenResty 平滑升级

    1.先去下载新版,当前最新版为“ngx_openresty-1.7.0.1” 2.开始升级 tar zxvf ngx_openresty-1.7.0.1.tar.gz cd ngx_openresty ...

  10. ACM 对决

    对决 时间限制:1000 ms  |  内存限制:65535 KB 难度:0   描述 Topcoder要招进来了 n 个新同学,Yougth计划把这个n个同学分成两组,要求每组中每个人必须跟另一组中 ...