PostgreSQL: From MVCC to Production
Twenty-eight chapters of PostgreSQL from storage internals to production operations, written without an ORM in sight. Starts with MVCC and the write-ahead log, works through every index type and query planning detail, then covers concurrency, replication, high availability with Patroni, and capacity planning.
794 pages
2025
English
What you'll learn
How MVCC works and why it matters for every query you write
The write-ahead log, buffer cache, and checkpoint mechanics
B-tree, GIN, GiST, BRIN, and partial indexes: when each one wins
Reading EXPLAIN and EXPLAIN ANALYZE output correctly
Row-level locking, deadlocks, and autovacuum tuning
Connection pooling with PgBouncer for production workloads
Streaming and logical replication in production
High availability with Patroni and point-in-time recovery with pgBackRest
Zero-downtime schema migrations and capacity planning
Table of Contents
Internals
- 01 The Postgres Way
- 02 MVCC, the Heart of Postgres
- 03 Storage (Pages, Tuples, TOAST, HOT)
- 04 The Write-Ahead Log
- 05 Processes, Memory, and the Buffer Cache
Querying
- 06 Indexes from First Principles
- 07 The Planner and Statistics
- 08 Reading EXPLAIN
- 09 Index Strategies (B-tree)
- 10 Specialty Indexes (GIN, GiST, BRIN, Hash)
- 11 Joins and Query Rewriting
- 12 JSONB at Production Scale
- 13 Full-Text Search
- 14 Schema Design and Partitioning
Concurrency
- 15 Isolation and Locking
- 16 Concurrency Patterns
- 17 Queues and the Outbox
- 18 Vacuum, Bloat, and Wraparound
- 19 Connection Pooling
Operations
- 20 Monitoring and the Slow-Query Workflow
- 21 Zero-Downtime Schema Migrations
- 22 Replication Internals
- 23 Streaming Replication in Production
- 24 Logical Replication
- 25 High Availability with Patroni
- 26 Backups and Point-in-Time Recovery
- 27 Installing and Tuning Postgres
- 28 Capacity Planning and Production Runbooks