PostgreSQL 14 Internals

A deep dive into the server mechanics

This book is for those who will not settle for a black-box approach when working with a database. Briefly touching upon the main concepts of PostgreSQL, the book then plunges into the depths of data consistency and isolation, explaining implementation details of multiversion concurrency control and snapshot isolation, buffer cache and write-ahead log, and the locking system. The rest of the book covers the questions of planning and executing SQL queries, including the discussion of data access and join methods, statistics, and various index types.

This book requires at least some general understanding of how PostgreSQL works. Entry-level users may find the text a bit difficult.

We expect that this book will also be useful for those who are familiar with another database system, but switch over to PostgreSQL and would like to understand how they differ.

Download in PDF or order a printed copy: hardcover, paperback

Contents at a glance:

  • Part I. Isolation and MVCC

    Isolation · Pages and Tuples · Snapshots · Page Pruning and HOT Updates · Vacuum and Autovacuum · Freezing · Rebuilding Tables and Indexes

  • Part II. Buffer Cache and WAL

    Buffer Cache · Write-Ahead Log · WAL Modes

  • Part III. Locks

    Relation-Level Locks · Row-Level Locks · Miscellaneous Locks · Locks in Memory

  • Part IV. Query Execution

    Query Execution Stages · Statistics · Table Access Methods · Index Access Methods · Index Scan · Nested Loop · Hashing · Merging and Sorting

  • Part V. Types of Indexes

    Hash · B-Tree · GiST · SP-GiST · GIN · BRIN