Tree & Concurrency
I'm currently reading dbms book and as i've understood Mvcc (Multi version concurrency control) is used for high concurrent read and write transactions. But "concurrency control on search structures" chapter mentions different locking concepts (lock coupling,link technique etc) for B-Trees.
Doesn't Mvcc applied on B-Tree's internal and leaf nodes in dbms? Are B-Tree concurrency and MVCC completeley different things?If so how Mvvc is implemented in dbms?
MVCC can be implemented in a variety of ways. The only requirement is that somehow older row versions are available.
For instance, SQL Server stores them in a temporary database that is reset when the server restarts.
Postgres stores row versions as hidden rows directly in the b-tree. It adds a hidden key column to the tree. When reading from the tree is only exposes the version that logically should be seen.
RavenDB's Voron manages b-tree pages as immutable data. Writes create entirely new trees. MVCC is therefore implemented as reading from the correct immutable tree.
Databases rarely lock physical structures for an extended amount of time. It is not a good idea to enable the database client to stop progress on database internal structures. Internal structures usually are locked very briefly. Logical row locks are treated separately.
If I had to guess concurrency control on search structures
refers to physical thread-safety. This usually does not involve MVCC because there is no need to manage multiple versions. Normal in-memory locks are sufficient for brief accesses.
上一篇: 如何实现简单的MVCC数据结构
下一篇: 树与并发