MVCC
Multi-Version Concurrency Control is a database concurrency control mechanism that maintains multiple versions of data so that reads do not block writes and writes do not block reads, preserving transaction isolation while maintaining high concurrency performance.
Timeline (last 90 days)
Traditional databases guarantee the isolation of concurrent transactions through locks, MVCC, and two-phase commit, but these mechanisms assume that participant behavior is deterministic and enumerable; when the participants are LLM-driven Agents, the set of operations is generated dynamically, and isolation levels and conflict detection rules are difficult to define in advance.
Concurrency control typically uses optimistic concurrency or MVCC (multi-version concurrency control), coordinating read-write conflicts by retaining multiple versions of the data.
For agent memory systems that require version rollback, the database must support multi-version concurrency control (MVCC) or snapshot isolation.
watch is implemented based on etcd's MVCC (multi-version concurrency control): each modification generates a new revision number, and clients can specify a revision to start watching from, thereby supporting replay of historical events and no event loss after reconnection.
A snapshot records the set of XIDs of all active transactions at a certain moment; when judging tuple visibility, the tuple's xmin and xmax are compared with the transaction states in the snapshot: if xmin has committed and is not in the snapshot's active set, and xmax is empty or uncommitted, the tuple is visible.
PostgreSQL maintains multiple physical versions of a tuple through MVCC, and a row tuple contains the hidden system columns xmin (the transaction ID that created the version) and xmax (the transaction ID that deleted or replaced the version).
Old versions of tuples under MVCC are reclaimed by the VACUUM process before they are no longer referenced by any active transaction snapshot, and long transactions prevent old versions from being reclaimed, causing disk bloat.
SELECT ... FOR UPDATE reads the latest committed version of the rows (bypassing MVCC snapshot isolation rules) and acquires an exclusive lock on each matching physical row found by the query.
OLTP systems almost all require strict ACID, using row-level locks or MVCC to manage concurrency.
Multi-version concurrency control (MVCC) generates new versions of data while retaining old versions, allowing read operations to choose a consistent snapshot based on the transaction start time without waiting for write operations to complete.
8 more timeline events
All Facts (19)
PostgreSQL的MVCC机制下,每次UPDATE操作实际上是写入一条新的行版本,对大JSONB字段频繁增量更新会导致写放大问题
95%UnverifiedMVCC (Multi-Version Concurrency Control) avoids read-write blocking by generating a new version for each write operation and having read operations read a consistent snapshot.
70%UnverifiedPostgreSQL internally contains multiple highly coupled subsystems, including a query parser, planner/optimizer, executor, storage manager (including MVCC multi-version concurrency control), and WAL write-ahead logging.
60%UnverifiedTraditional databases guarantee the isolation of concurrent transactions through locks, MVCC, and two-phase commit, but these mechanisms assume that participant behavior is deterministic and enumerable; when the participants are LLM-driven Agents, the set of operations is generated dynamically, and isolation levels and conflict detection rules are difficult to define in advance.
50%UnverifiedConcurrency control typically uses optimistic concurrency or MVCC (multi-version concurrency control), coordinating read-write conflicts by retaining multiple versions of the data.
50%UnverifiedFor agent memory systems that require version rollback, the database must support multi-version concurrency control (MVCC) or snapshot isolation.
50%Unverifiedwatch is implemented based on etcd's MVCC (multi-version concurrency control): each modification generates a new revision number, and clients can specify a revision to start watching from, thereby supporting replay of historical events and no event loss after reconnection.
50%UnverifiedA snapshot records the set of XIDs of all active transactions at a certain moment; when judging tuple visibility, the tuple's xmin and xmax are compared with the transaction states in the snapshot: if xmin has committed and is not in the snapshot's active set, and xmax is empty or uncommitted, the tuple is visible.
50%UnverifiedSELECT ... FOR UPDATE reads the latest committed version of the rows (bypassing MVCC snapshot isolation rules) and acquires an exclusive lock on each matching physical row found by the query.
50%UnverifiedOld versions of tuples under MVCC are reclaimed by the VACUUM process before they are no longer referenced by any active transaction snapshot, and long transactions prevent old versions from being reclaimed, causing disk bloat.
50%UnverifiedPostgreSQL maintains multiple physical versions of a tuple through MVCC, and a row tuple contains the hidden system columns xmin (the transaction ID that created the version) and xmax (the transaction ID that deleted or replaced the version).
50%UnverifiedOLTP systems almost all require strict ACID, using row-level locks or MVCC to manage concurrency.
50%UnverifiedIn HTAP scenarios, MVCC's version chain and visibility determination mechanism allow analytical queries to read the latest committed data version without stopping transactional writes, thereby eliminating read-write conflicts and avoiding ETL synchronization latency.
50%UnverifiedMulti-version concurrency control (MVCC) generates new versions of data while retaining old versions, allowing read operations to choose a consistent snapshot based on the transaction start time without waiting for write operations to complete.
50%UnverifiedInnoDB's MVCC is implemented by modifying rows in place and tracking old versions with an undo chain: each row hides a transaction ID and a rollback pointer, and the rollback pointer strings together old versions in the undo log to form a version chain; read committed (RC) generates a new snapshot on each statement execution, while repeatable read (RR) generates a snapshot at transaction start.
50%UnverifiedMySQL's default isolation level is repeatable read, which implements snapshot reads through MVCC to avoid non-repeatable reads.
50%UnverifiedLinux's fork() system call, ZFS filesystem snapshot functionality, and the MVCC mechanisms of many modern databases all rely on the copy-on-write principle.
50%UnverifiedPostgreSQL's MVCC mechanism, ZFS/Btrfs filesystem snapshots, and some cloud database services use copy-on-write or similar storage tiering technology as their underlying foundation.
50%UnverifiedWhen the number of subtransactions exceeds 64 and a subxid overflow occurs, other transactions must frequently access the pg_subtrans SLRU cache during MVCC visibility checks, leading to intensified lock contention, increased disk I/O, and reduced throughput.
50%