Multiversion concurrency control (MVCC)

202504291915
Status: #idea
Tags:

Multiversion concurrency control (MVCC)

Introduction

Ideas

Info

MVCC without GC supports time-travel queries

Example

Pasted image 20250429191936.png
Notice that T2 sets the end timestamp for T1

Attention

Tb can NOT create a new version if Ta has not committed (i.e. is still active), if a<b

Warning

Snapshot isolation is susceptible to write-skew anomaly

Version storage

1) Append-only storage

Version chain ordering

  1. Oldest to Newest (O2N)
    • Lookups traverse (version) chain
  2. Newest to Oldest (N2O)
    • Need to update the index pointers every version
    • Better (most txns only care about latest value)

2) Time-travel storage

3) Delta storage

Garbage collection

1) Tuple-level

a) Background vacuuming

b) Cooperative cleaning

2) Txn-level

Index management

1) Logical pointer

2) Physical address

Deletes

1) Deleted flag

2) Tombstone tuple

Using MVCC on a Binary Tree


References

  1. CMU IntroDB
    1. Lecture
    2. Slides