PGSimCity · How PostgreSQL Works, in 3D

nikolays.github.io · 2026-07-27 · by Long Nguyen ·generic
PGSimCity — an explorable 3D city that shows how PostgreSQL actually works.

PGSimCity · How PostgreSQL Works, in 3D

live simulation · selected relation

sessionsblock 15

latest resident block · occupancy from relation counters

live tuples29.4k

dead tuples610

relation bloat2.0%

page free818 B

VM signalclear / unknown

R

Representative, not decoded. Relation counters drive density and deadness; a real resident block number is used when available. The simulation does not retain each block’s tuple bytes.

one heap page · exact byte proportions

0 → 8,192 bytes

BLCKSZ = 8192

0304 · pd\_lowerpd\_upper · 11228192

line pointers grow forward →← tuples grow backward

Line pointers70 × 4 B · 280 BFree space818 B · 304…1122Heap tuples7,070 B · grow backwardSpecial0 B on heap

slot array

ItemIdData\[\]

70 slots · 69 normal · 1 dead

lp\_off15 bitslp\_flags2 bitslp\_len15 bits

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970

LP\_UNUSED0 · reusableLP\_NORMAL1 · tupleLP\_REDIRECT2 · HOTLP\_DEAD3 · cleanup

tuple opened · HOT teaching example

HeapTupleHeaderData → bitmap → user data

23 B fixed

t\_xmin4 Bxid 100,017t\_xmax4 Bxid 100,023 · updatedt\_cid / t\_xvac4 B unioncid 0 · shared wordt\_ctid6 B(15,2) → newert\_infomask22 Bnatts 6 · HOT\_UPDATEDt\_infomask2 BHASNULL · XMIN\_COMMITTEDt\_hoff1 B24 · MAXALIGNnull bitmap1 B example111110 · 6 attrsuser datafrom t\_hoffid · status · payload…

index → LP\[1\]→old tuple · t\_ctid→new tuple on same page

nikolays.github.io · 12 links

Comments (0)

No comments yet