PostgreSQL 14 Internals
Look inside the database. Explore MVCC, the buffer cache, WAL, locking, the planner, and every major index type.
PostgreSQL 14 · Translated from Russian by Liudmila Mantrova · Chinese translation by Xiong Cancan

Egor Rogov
PostgreSQL 14 · 2023
Start reading · Print the whole book · Original PDF
Contents
Figures
- Figure 1.1 — Databases
- Figure 1.2 — Tablespaces
- Figure 1.3 — Files and Forks
- Figure 1.4 — 1.2 Processes and Memory
- Figure 3.1 — Page Header
- Figure 4.1 — 4.1 What is a Snapshot?
- Figure 4.2 — 4.2 Row Version Visibility
- Figure 4.3 — 4.3 Snapshot Structure
- Figure 4.4 — 4.3 Snapshot Structure
- Figure 4.5 — 4.5 Transaction Horizon
- Figure 7.1 — 7.1 Transaction ID Wraparound
- Figure 7.2 — 7.2 Tuple Freezing and Visibility Rules
- Figure 7.3 — Age for Forced Autovacuum
- Figure 9.1 — 9.2 Buffer Cache Design
- Figure 9.2 — 9.3 Cache Hits
- Figure 9.3 — Buffer Search and Eviction
- Figure 10.1 — 10.3 Checkpoint
- Figure 10.2 — 10.3 Checkpoint
- Figure 10.3 — Configuring Checkpoints
- Figure 13.1 — Exclusive Modes
- Figure 13.2 — Exclusive Modes
- Figure 13.3 — Exclusive Modes
- Figure 13.4 — Shared Modes
- Figure 13.5 — 13.6 Deadlocks
- Figure 15.1 — Buffer Cache
- Figure 15.2 — WAL Buffers
- Figure 16.1 — 16.2 Simple Query Protocol
- Figure 16.2 — Parsing
- Figure 16.3 — Transformation
- Figure 16.4 — Planning
- Figure 16.5 — Planning
- Figure 16.6 — Planning
- Figure 16.7 — Planning
- Figure 16.8 — Execution
- Figure 17.1 — 17.3 Distinct Values
- Figure 17.2 — 17.4 Most Common Values
- Figure 17.3 — 17.5 Histogram
- Figure 17.4 — 17.5 Histogram
- Figure 18.1 — 18.2 Sequential Scans
- Figure 18.2 — 18.3 Parallel Plans
- Figure 18.3 — Cost Estimation
- Figure 19.1 — 19.1 Indexes and Extensibility
- Figure 20.1 — Good Scenario: High Correlation
- Figure 20.2 — Bad Scenario: Low Correlation
- Figure 20.3 — Bad Scenario: Low Correlation
- Figure 20.4 — Cost Estimation
- Figure 20.5 — Cost Estimation
- Figure 20.6 — 20.5 Comparison of Various Access Methods
- Figure 22.1 — One-Pass Hash Joins
- Figure 22.2 — One-Pass Hash Joins
- Figure 22.3 — Two-Pass Hash Joins
- Figure 22.4 — Two-Pass Hash Joins
- Figure 22.5 — Two-Pass Hash Joins
- Figure 22.6 — Parallel One-Pass Hash Joins
- Figure 22.7 — Parallel One-Pass Hash Joins
- Figure 22.8 — Parallel Two-Pass Hash Joins
- Figure 22.9 — Parallel Two-Pass Hash Joins
- Figure 22.10 — Parallel Two-Pass Hash Joins
- Figure 22.11 — Parallel Two-Pass Hash Joins
- Figure 23.1 — External Sorting
- Figure 23.2 — External Sorting
- Figure 23.3 — External Sorting
- Figure 23.4 — External Sorting
- Figure 23.5 — 23.4 Comparison of Join Methods
- Figure 24.1 — 24.2 Page Layout
- Figure 24.2 — 24.2 Page Layout
- Figure 24.3 — 24.2 Page Layout
- Figure 25.1 — 25.1 Overview
- Figure 25.2 — Search by Equality
- Figure 25.3 — Search by Inequality
- Figure 25.4 — Search by Range
- Figure 25.5 — Insertions
- Figure 25.6 — 25.3 Page Layout
- Figure 26.1 — 26.2 R-Trees for Points
- Figure 26.2 — 26.2 R-Trees for Points
- Figure 26.3 — 26.2 R-Trees for Points
- Figure 26.4 — Search for Contained Elements
- Figure 26.5 — Search for Contained Elements
- Figure 26.6 — Search for Contained Elements
- Figure 26.7 — Search for Contained Elements
- Figure 26.8 — Nearest Neighbor Search
- Figure 26.9 — Nearest Neighbor Search
- Figure 26.10 — Nearest Neighbor Search
- Figure 26.11 — Insertion
- Figure 26.12 — Insertion
- Figure 26.13 — Indexing tsvector Data
- Figure 26.14 — Indexing tsvector Data
- Figure 26.15 — Indexing tsvector Data
- Figure 26.16 — Indexing tsvector Data
- Figure 27.1 — 27.2 Quadtrees for Points
- Figure 27.2 — 27.2 Quadtrees for Points
- Figure 27.3 — 27.2 Quadtrees for Points
- Figure 27.4 — Operator Class
- Figure 27.5 — Operator Class
- Figure 27.6 — Page Layout
- Figure 27.7 — Search
- Figure 27.8 — Search
- Figure 27.9 — Insertion
- Figure 27.10 — Insertion
- Figure 27.11 — Insertion
- Figure 27.12 — Insertion
- Figure 27.13 — 27.3 K-Dimensional Trees for Points
- Figure 27.14 — 27.3 K-Dimensional Trees for Points
- Figure 27.15 — 27.3 K-Dimensional Trees for Points
- Figure 27.16 — 27.4 Radix Trees for Strings
- Figure 27.17 — Search
- Figure 27.18 — Insertion
- Figure 27.19 — Insertion
- Figure 27.20 — Insertion
- Figure 28.1 — 28.2 Index for Full-Text Search
- Figure 28.2 — Search
- Figure 28.3 — Frequent and Rare Lexemes
- Figure 28.4 — Insertions
- Figure 28.5 — jsonb_ops Operator Class
- Figure 28.6 — jsonb_path_ops Operator Class
- Figure 29.1 — 29.3 Page Layout
- Figure 29.2 — Value Insertion
- Figure 29.3 — Range Size and Search Efficiency
- Figure 29.4 — 29.7 Minmax-Multi Classes
- Figure 29.5 — 29.7 Minmax-Multi Classes
- Figure 29.6 — 29.9 Bloom Classes
Tables
- Table 2.1 — Isolation levels and anomalies in the SQL standard
- Table 2.2 — Isolation levels and anomalies in PostgreSQL
- Table 12.1 — Transaction ID lock compatibility (× marks a conflict)
- Table 12.2 — Relation-level lock compatibility (× marks a conflict)
- Table 13.1 — Row-level lock compatibility (× marks a conflict)
- Table 18.1 — Table size and number of parallel processes
- Table 26.1 — Lexeme signatures
- Table 26.2 — Document signatures
- Table 28.1 — Consistency function for “everywher” or “oink”
- Table 28.2 — Consistency function for mandatory and optional lexemes
About this edition
© Postgres Professional, 2022–2023. The English text and illustrations are reproduced from the PostgreSQL 14 · 2023 PDF. This web edition keeps the original chapter order, examples, and version-specific behavior. Figure and table numbers are added for web navigation; the PDF’s diagrams and tables are unnumbered. Original page references link to their corresponding locations in the chapters.