Skip to content
TechWithSwag

Series · 6 parts

PostgreSQL Internals

How PostgreSQL executes a query, finds your data, and why its B-tree indexes behave the way they do.

  1. What happens between hitting enter on a SELECT and the rows coming back: parser, planner, executor, the buffer manager, and when it finally touches disk.

    · 11 min read

  2. A closer look at the part I glossed over last time: what a B-tree index actually looks like on disk, when Postgres reaches for a bitmap scan instead, and how an index-only scan skips the table entirely.

    · 9 min read

  3. Why an index lookup touches only a handful of pages, what every extra index quietly costs on writes, and how to think about composite indexes as one sorted list instead of a bag of columns.

    · 11 min read

  4. Follow one query from your keyboard to the disk and back, with an animation you can click through, and the one command that shows you every stage.

    · 7 min read

  5. When PostgreSQL says COMMIT succeeded, your table pages may not be on disk yet. Here is how the write-ahead log, row versions and checkpoints make that safe.

    · 9 min read

  6. Both are 128-bit UUIDs, but one scatters inserts across your B-tree and the other keeps them on the right edge. What that changes, what it doesn't, and how to measure it.

    · 7 min read