The Internals of PostgreSQL

interdb.jp

376 points by ibobev 4 days ago


dang - 4 days ago

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)

gopalv - 4 days ago

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.

weitendorf - 3 days ago

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
jon128 - 4 days ago

Didn't find the new MVCC in there.

  https://www.orioledb.com/