PostgreSQL Deep Dive: MVCC, Vacuum, Plans, and Replication

PostgreSQL below the SQL surface. Processes and shared memory, heap pages and TOAST, the write ahead log and checkpoints, MVCC with xmin and xmax, vacuum and autovacuum, transaction ID wraparound, HOT updates, B-tree, GIN, GiST and BRIN indexes, reading EXPLAIN ANALYZE, statistics and the planner, joins and query tuning, locks and lock queues, isolation levels, connection pooling, zero downtime migrations, JSONB and full text search, streaming and logical replication, partitioning, backups and upgrades, and performance tuning.
Level: Advanced
Study Time: 12h
Lessons: 22
Quizzes: 374
Course Overview

Most engineers use PostgreSQL every day and still meet its internals only during an incident: a table that keeps growing after deletes, a migration that froze every query behind one lock, a query that was fast yesterday and slow today, a replica that fell hours behind, a warning that the database will stop accepting writes to prevent wraparound. Each of these has a precise cause inside the engine, and each becomes predictable once you know how Postgres stores rows, versions them and plans queries over them.

The first section covers architecture and storage: the process per connection model and shared memory, how rows live in heap pages with TOAST for large values, and how the write ahead log and checkpoints make commits durable. The second section is MVCC and vacuum: how xmin, xmax and snapshots decide which row versions a query sees, why updates leave dead tuples behind, how vacuum and autovacuum reclaim them, why transaction IDs must be frozen before they wrap around, and how HOT updates and fillfactor avoid index churn.

The third section is indexes and query planning: B-tree indexes in practice, the specialized GIN, GiST, SP-GiST and BRIN access methods, reading EXPLAIN ANALYZE output node by node, the statistics that drive cost estimates, and the join strategies and rewrites that fix slow queries. The fourth section covers concurrency and schema: row and table locks and the lock queue that turns a quick ALTER into an outage, how isolation levels behave in Postgres, connection pooling with PgBouncer, migrations that change a busy schema without downtime, and JSONB and full text search.

The last section covers replication and scale: streaming replication and failover, logical replication and change data capture, declarative partitioning, backups with point in time recovery and major version upgrades, and the monitoring views and settings that matter when tuning a production server. Judged coding problems simulate the engine, from tuple visibility to vacuum thresholds, and notebooks run against a real PostgreSQL server.

PostgreSQL Deep Dive: MVCC, Vacuum, Plans, and Replication
Enroll Now

Get instant access to all current and upcoming courses by subscribing.