One engineer has spent 11 years mapping the internals of PostgreSQL

One engineer has spent 11 years mapping the internals of PostgreSQL

Hironobu Suzuki's free online guide dissects PostgreSQL's subsystems chapter by chapter, from the buffer manager and VACUUM processing to WAL, streaming replication, and a new beta chapter on logical replication. It now covers version 19-beta, has been cited in academic papers, and was published in Chinese in 2019. Suzuki writes it for his own enjoyment and charges €5,000,000 for a full commercial buyout.

I am writing for my own enjoyment. Even if you send me your article, I will never include it in my documentation.
  1. dang

    Related:

    The Internals of PostgreSQL - https://news.ycombinator.com/item?id=43241404 - March 2025 (40 comments)

    The Internals of PostgreSQL - https://news.ycombinator.com/item?id=30372750 - Feb 2022 (19 comments)

    The Internals of PostgreSQL - https://news.ycombinator.com/item?id=30086374 - Jan 2022 (39 comments)

    Internals of PostgreSQL - https://news.ycombinator.com/item?id=18950460 - Jan 2019 (25 comments)

    The internals of PostgreSQL - https://news.ycombinator.com/item?id=13488315 - Jan 2017 (53 comments)

    The Internals of PostgreSQL - https://news.ycombinator.com/item?id=12142364 - July 2016 (1 comment)

    (Reposts are fine after a year or so; links to past threads are just to satisfy extra-curious readers)

  2. gopalv

    The latest Jepsen report on particledb triggered a new found interest in the SSI implementation in postgres.

    If you are just skimming this doc, The HoT update path is the section I would jump to.

    Understand HoT and then read the zHeap implementation notes (also of TOAST) puts a good mental model of what postgres does and what it doesn't do.

  3. weitendorf

    Didn't see alignment padding mentioned anywhere so I'll drop it here: did you know that the order of a table's columns affects how much space a record uses?

    bigint, bigint, bool, bool: 18 bytes (8+8+1+1), aligned up to 24

    bool, bigint, bool, bigint: 32 bytes (1 + 7 (alignment padding) + 8 + 1 + 7 + 8)

    But wait! There is the per-row overhead of ~30bytes. Your 18 byte row actually takes 54bytes of space. Well, multiples of 54 depending on how often you update/vacuum it. But don't make your rows too big either or you're TOAST

  4. jon128

    Didn't find the new MVCC in there.

    https://www.orioledb.com/

  5. hubertzhang

    Back in 2018, when I was at Greenplum, my team worked through The Internals of PostgreSQL together alongside Andy Pavlo’s CMU database courses. It was invaluable for anyone working on the database kernel. Today, a beginner can get that same interactive learning experience simply by chatting with AI, much like the discussions our team had back then.

    Now I’m building Lavik, a new cache service for PostgreSQL. Traditional caches like Redis are DRAM-based, so they can only hold a small slice of hot data. Once your data outgrows memory, you’re exposed to cache miss storms, where a flood of requests falls through to PostgreSQL all at once. Nobody likes those. (OpenAI encounter the similar cache miss storms problem: https://openai.com/index/scaling-postgresql/)

    Lavik takes a different path: it runs on NVMe SSDs, and it’s still faster than Redis running on DRAM. That’s not what most people expect. Conventional wisdom says SSD-based systems trade speed for capacity, but Lavik gives you both. You can keep TB-scale data in cache while getting 1M QPS and sub-millisecond P99 latency.

    Lavik is open source under the Apache License.

    GitHub: https://github.com/eloqdata/lavik

    Website: https://lavik.dev

More from this day

2026-11-03