Multi-Version Concurrency Control
PostgreSQL doesn't use traditional read locks. Instead, every row update creates a new version of the row. Old versions stick around until no transaction can possibly need them, then VACUUM cleans them up. Result: readers don't block writers, writers don't block readers. This is the deep reason PostgreSQL scales reads so well.
What MVCC means in practice
- Two readers querying the same table never wait on each other.
- A reader sees the snapshot as of when its transaction (or query, depending on isolation) began — not affected by concurrent writers.
- Two writers updating the same row block each other (one waits, then sees the result of the other).
- Dead row versions accumulate; VACUUM cleans them periodically.
The dead-tuple cost
Every UPDATE in PostgreSQL is "create a new version + mark the old one dead." Heavily-updated tables accumulate dead tuples until VACUUM reclaims the space. In extreme cases this is bloat; we'll see how to monitor it in the Operations track.