Learning Pathway
01 — Foundations: PostgreSQL Internals 101
8 lessons- 01 MVCC Internals: How PostgreSQL Stores Row Versions How PostgreSQL implements MVCC at the source level: xmin, xmax, t_infomask in the heap tuple header, and why every UPDATE creates a new row…
- 02 Write-Ahead Logging: How WAL Guarantees Durability How the PostgreSQL WAL works at the source level: XLogInsert, LSNs, the WAL buffer, fsync at commit, and crash recovery replay.
- 03 The Buffer Cache: How shared_buffers and Clock-Sweep Work How the PostgreSQL buffer manager works: BufferDesc, the buffer mapping hash table, pinning, and the clock-sweep eviction algorithm in freelist.c.
- 04 Autovacuum Internals: How Dead Tuples Are Reclaimed How autovacuum works at the source level: the launcher/worker model, the dead-tuple threshold formula, vacuumlazy.c phases, and visibility-map maintenance.
- 05 The Page Layout: How PostgreSQL Stores Rows on Disk The anatomy of an 8KB PostgreSQL heap page: PageHeaderData, the ItemId line-pointer array, tuples filling from the end, and free-space management.
- 06 Snapshots and Visibility: How PostgreSQL Decides What You See How PostgreSQL snapshots work at the source level: SnapshotData (xmin/xmax/xip), GetSnapshotData, and how isolation levels change snapshot timing.
- 07 TOAST: How PostgreSQL Stores Oversized Values How TOAST works at the source level: the 2KB threshold, compression and out-of-line storage, varlena headers, and the per-table TOAST relation.
- 08 The Lock Manager: How PostgreSQL Coordinates Concurrent Access How PostgreSQL locking works at the source level: heavyweight locks in lock.c, the lock mode conflict table, lightweight locks (LWLocks), and deadlock detection.