# 1.4 MVCC (The Sharpie Ledger)

In the warehouse of the Lazy Elephant, there is a strict rule: **Never use an eraser.**
If you ask the elephant to update a record—say, changing a user's phone number—a high-effort database would find the exact spot on disk, carefully rub out the old data, and write the new one in its place. This is called "In-Place" updating, and it’s exhausting. It requires locking the door to the filing cabinet so nobody else can read while you’re erasing, which leads to long lines and grumpy elephants.
## The Art of the Sharpie
Instead of erasing anything, Postgres uses **Multi-Version Concurrency Control (MVCC)**. When you tell the elephant to UPDATE a row, it performs a simple, two-step lazy dance:
1. **Ignore the old one**: It leaves the old row exactly where it is.
2. **Write a new one**: It walks to a fresh, empty spot at the end of the page and writes the entire row from scratch with the new phone number.
3. **The Scribble**: It walks past the old row and quickly scribbles a tiny "EXPIRED" note with an invisible red Sharpie.
Because the old version still exists, other elephants who were already reading it can finish their business without being interrupted. They see the version they started with, while new visitors see the fresh one. This is how Postgres allows multiple people to read and write the exact same data at the same time without ever fighting over locks.
## The Cost of Garbage
This "Append-Only" lifestyle makes Postgres incredibly fast and consistent, but it leaves the warehouse floor covered in old, crossed-out suitcases. In technical terms, we call this **Bloat**.
If left alone, the elephant would eventually be wading knee-deep through dead rows just to find a single living one. This is where the **Autovacuum Roomba** comes in—a background worker that silently sweeps up the "Sharpie-marked" rows and marks their space as `Available for Rent` for future suitcases.
Doing the least work possible today (just crossing it out) ensures we don't have to wait around for erasers, even if it means we need a little cleanup tomorrow.
---
[[Chapter 1/1.3 - The Table|← 1.3 - The Table]] | [[Chapter 1/1.0 - The Building Blocks|↑ 1.0 - The Building Blocks]] | [[Chapter 2/2.0 - The Mighty Indexes|2.0 - The Mighty Indexes →]]