Preface: Why This Book Exists
About the Author
Who This Book Is For
How to Use This Book
Volume I: FOUNDATIONS & CORE CONCEPTS
- What You’ll Learn
- Why This Matters
- How to Read Part I
Chapter 1: PostgreSQL Architecture at a Glance
- Overview
- The Cost of Wrong Assumptions
- 1.1 The PostgreSQL Process Model
- 1.2 Memory Architecture
- 1.3 Data Flow from Query to Disk
- 1.4 Why Understanding Architecture Changes Everything
- 1.5 Asynchronous I/O (AIO) Overview (PostgreSQL 18)
- Learning Objectives
- Exercises
- References & Diagnostics
Chapter 2: Transaction Model & ACID Fundamentals
- Overview
- 2.1 What ACID Really Means in PostgreSQL
- 2.2 Transaction Lifecycle
- 2.3 The Write-Ahead Log (Preview)
- 2.4 Atomicity in Practice
- 2.5 Consistency: Business Logic’s Job
- 2.6 Real-World Scenario: Race Condition at 3 AM
- 2.7 Choosing Your Isolation Level
- Learning Objectives
- Exercises
- References & Diagnostics
- Bridge to Chapter 3 – Isolation Levels
Chapter 3: Isolation Levels & Snapshot Isolation
- Overview
- 3.1 The Four Isolation Levels
- 3.2 Read Committed (The Default Isolation Level)
- 3.3 Repeatable Read (Snapshot Isolation)
- 3.4 Serializable (SSI)
- 3.5 Decision Framework
- 3.6 Case Study: Payment System Gone Wrong
- 3.7 Practical Patterns and Anti-Patterns
- Exercises
- References & Diagnostics
- Bridge to Chapter 4 – MVCC
Chapter 4: MVCC – The Core Concept
- Overview
- 4.1 Why PostgreSQL Never Locks Readers
- 4.2 Transaction Identifiers (XID)
- 4.3 Tuple Structure: xmin, xmax, and Hint Bits
- 4.4 The Visibility Algorithm
- 4.5 The Cost of MVCC
- 4.6 Vacuum, Pruning, and the Visibility Map
- 4.7 MVCC vs Other Concurrency Models
- 4.8 Practical Implications
- 4.9 Case Study: The Runaway Bloat Incident
- Learning Objectives
- Exercises
- References & Diagnostics
- Bridge to Chapter 5 – Storage & Pages
Chapter 5: Storage & Pages
- Overview
- 5.1 The Page: PostgreSQL’s Fundamental Unit
- 5.2 Page Internal Layout
- 5.3 Row Organization Within Pages: The ctid
- 5.4 Free Space Management: FSM and VM
- 5.5 TOAST: For Values That Don’t Fit
- 5.6 Files and Forks
- 5.7 Fillfactor and Page Packing Strategy
- 5.8 Asynchronous I/O in the Storage Stack (v18)
- 5.9 Case Study: The Page-Split Performance Cliff
- Exercises
- Bridge to Chapter 6
- References
Chapter 6: Buffer Cache – The Speed Layer
- 6.1 The Buffer Cache Concept
- 6.2 Shared Buffers and Double Buffering
- 6.3 Anatomy of a Buffer
- 6.4 Lifecycle: Hit, Miss, Read, Dirty
- 6.5 Eviction: Clock Sweep (LRU Approximation)
- 6.6 Dirty Pages, WAL, and Checkpoints
- 6.7 Measuring Cache Effectiveness
- 6.8 Sizing Strategy
- 6.9 Cache Warming
- 6.10 Operational Pitfalls
- 6.11 Case Study: The Oversized Cache
- 6.12 Diagnostics Checklist
- Exercises
- Conclusion
- Looking Ahead: Bridging to Volume 2