dataiotech Labs
dbaguidedbaguideDBAdataxtoolsdataopsphere
dbaguide.com
MVCCConcurrency

Multi-Version Concurrency Control (Çoklu Sürüm Eşzamanlılık Denetimi)

A concurrency model where readers do not block writers, and writers do not block readers, providing consistent point-in-time snapshots.

Internal Architecture Breakdown

MVCC prevents current transactions from directly overwriting active data pages during UPDATE and DELETE operations by maintaining version snapshots:

  • •PostgreSQL: Appends an entirely new version of the row (tuple) onto an 8KB heap page, tagging it with xmin and xmax transaction IDs. Older tuple versions become invisible to newly created transaction snapshots and are subsequently reclaimed by the asynchronous VACUUM worker.
  • •MySQL (InnoDB): Modifies the row in-place within the clustered index leaf, but writes previous row versions into dedicated Undo Tablespace rollback segments. Readers requiring point-in-time snapshots reconstruct historic row states dynamically using these undo log records, while background Purge Threads reclaim obsolete segments once no longer required.

Production Inspection Queries

PostgreSQL
SELECT n_dead_tup, n_live_tup, last_vacuum, last_autovacuum FROM pg_stat_user_tables WHERE relname = 'users';
MySQL
SHOW ENGINE INNODB STATUS; -- Check "History list length" under TRANSACTIONS section