AdvancedAdvanced PostgreSQL
Theory: What is MVCC?
The query
SQL
-- Q: What is MVCC in PostgreSQL?
-- A: Multi-Version Concurrency Control.
-- It ensures that readers do not block writers and writers do not block readers.
-- Instead of locking rows for reading, PostgreSQL keeps multiple versions
-- of a row. A transaction sees a "snapshot" of data from when it started.Note
“MVCC is the secret behind PostgreSQL's excellent performance under heavy concurrent loads.