{"schema": "pgtrue.report/1", "url": "https://pgtrue.postgres.ai/shared/brief/979078fd-6b1a-42ff-89f4-fbfd9d2f4443", "published": "2026-10-19T08:38:39Z", "publisher": "PostgresAI", "article": {"title": "Postgres FM | Transcript: GSoC B-Tree Merge", "url": "https://postgres.fm/episodes/gsoc-btree-merge/transcript", "date_published": "2026-09-25T00:00:00Z", "author": "Michael Christofides, Nikolay Samokhvalov, Kirk Wolak, and Salma El-Sayed", "publisher": "Postgres.FM"}, "grade": "A-", "axes": [{"axis": "Factual", "summary": "A \u00b7 0 wrong of 15 checked \u00b7 0 caveats"}, {"axis": "Applicable", "summary": "A \u00b7 0 wrong of 7 checked \u00b7 1 caveat"}, {"axis": "Consistent", "summary": "A \u00b7 0 wrong of 15 checked \u00b7 0 caveats"}, {"axis": "Transparent", "summary": "A \u00b7 0 wrong of 3 checked \u00b7 0 caveats"}, {"axis": "Safe", "summary": "not applicable"}], "findings": [{"anchor": "F1", "url": "https://pgtrue.postgres.ai/shared/brief/979078fd-6b1a-42ff-89f4-fbfd9d2f4443#F1", "claim": "\u2026it will be truncated even if it's in the middle\u2026", "title": "VACUUM retains deleted index pages for reuse", "explanation": "VACUUM does not shrink the B-tree file. src/backend/access/nbtree/nbtree.c:1496-1501 records recyclable pages in the free-space map. doc/src/sgml/maintenance.sgml:169-174 distinguishes reuse from returning disk space. Repeating VACUUM will not reclaim that file space.", "verdict": "Mostly accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/src/backend/access/nbtree/nbtree.c#L1496-L1501", "label": "REL_19_STABLE@16dd909023 \u00b7 src/backend/access/nbtree/nbtree.c:1496-1501"}, {"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/doc/src/sgml/maintenance.sgml#L169-L174", "label": "REL_19_STABLE@16dd909023 \u00b7 doc/src/sgml/maintenance.sgml:169-174"}]}, {"anchor": "F2", "url": "https://pgtrue.postgres.ai/shared/brief/979078fd-6b1a-42ff-89f4-fbfd9d2f4443#F2", "claim": "\u2026it should be fully empty\u2026", "title": "Existing page deletion requires an empty leaf", "explanation": "src/backend/access/nbtree/nbtpage.c:1926-1934 rejects a leaf containing data items. Deletion marks an eligible page half-dead and then unlinks it. Snapshot safety delays recycling. The existing code does not consolidate partially occupied leaves.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/src/backend/access/nbtree/nbtpage.c#L1926-L1934", "label": "REL_19_STABLE@16dd909023 \u00b7 src/backend/access/nbtree/nbtpage.c:1926-1934"}, {"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/src/backend/access/nbtree/nbtpage.c#L2030-L2053", "label": "REL_19_STABLE@16dd909023 \u00b7 src/backend/access/nbtree/nbtpage.c:2030-2053"}, {"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/src/backend/access/nbtree/README#L394-L398", "label": "REL_19_STABLE@16dd909023 \u00b7 src/backend/access/nbtree/README:394-398"}, {"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/src/include/access/nbtree.h#L226-L226", "label": "REL_19_STABLE@16dd909023 \u00b7 src/include/access/nbtree.h:226-226"}]}, {"anchor": "F3", "url": "https://pgtrue.postgres.ai/shared/brief/979078fd-6b1a-42ff-89f4-fbfd9d2f4443#F3", "claim": "\u2026it was trying to avoid splitting\u2026", "title": "Bottom-up deletion attempts to avoid page splits", "explanation": "src/backend/access/nbtree/nbtinsert.c:2821-2823 automatically invokes bottom-up deletion for eligible insertions. doc/src/sgml/btree.sgml:686-689 identifies anticipated version-churn splits as its trigger. PostgreSQL 14.0 already calls this operation. It deletes obsolete tuples within a page without merging leaves.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/src/backend/access/nbtree/nbtinsert.c#L2821-L2823", "label": "REL_19_STABLE@16dd909023 \u00b7 src/backend/access/nbtree/nbtinsert.c:2821-2823"}, {"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/doc/src/sgml/btree.sgml#L686-L689", "label": "REL_19_STABLE@16dd909023 \u00b7 doc/src/sgml/btree.sgml:686-689"}, {"url": "https://github.com/postgres/postgres/blob/86a4dc1e6f29d1992a2afa3fac1a0b0a6e84568c/src/backend/access/nbtree/nbtinsert.c#L2745-L2745", "label": "REL_14_0 \u00b7 src/backend/access/nbtree/nbtinsert.c:2745-2745"}]}, {"anchor": "F4", "url": "https://pgtrue.postgres.ai/shared/brief/979078fd-6b1a-42ff-89f4-fbfd9d2f4443#F4", "claim": "\u2026the last sort key is the TID\u2026", "title": "Heap TID breaks ties between equal B-tree keys", "explanation": "src/backend/access/nbtree/nbtsearch.c:795-799 uses heap TID after comparing indexed attributes. Equal logical keys consequently have a physical order. ItemPointerData stores a block identifier and an offset number. This supports the ordering premise of the proposed recovery design.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/src/backend/access/nbtree/nbtsearch.c#L795-L799", "label": "REL_19_STABLE@16dd909023 \u00b7 src/backend/access/nbtree/nbtsearch.c:795-799"}, {"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/src/backend/access/nbtree/README#L42-L44", "label": "REL_19_STABLE@16dd909023 \u00b7 src/backend/access/nbtree/README:42-44"}, {"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/src/include/storage/itemptr.h#L36-L40", "label": "REL_19_STABLE@16dd909023 \u00b7 src/include/storage/itemptr.h:36-40"}, {"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/src/backend/access/nbtree/nbtsearch.c#L307-L310", "label": "REL_19_STABLE@16dd909023 \u00b7 src/backend/access/nbtree/nbtsearch.c:307-310"}]}, {"anchor": "F6", "url": "https://pgtrue.postgres.ai/shared/brief/979078fd-6b1a-42ff-89f4-fbfd9d2f4443#F6", "claim": "\u2026like following heap2, which is already introduced\u2026", "title": "Heap2 already exists as a separate resource manager", "explanation": "src/include/access/rmgrlist.h:37 registers RM_HEAP2_ID with heap2_redo and its description functions. Heap2 provides the stated precedent for extending WAL operation capacity through another resource manager.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/src/include/access/rmgrlist.h#L37-L37", "label": "REL_19_STABLE@16dd909023 \u00b7 src/include/access/rmgrlist.h:37-37"}]}, {"anchor": "F7", "url": "https://pgtrue.postgres.ai/shared/brief/979078fd-6b1a-42ff-89f4-fbfd9d2f4443#F7", "claim": "\u2026I would also check maybe pgstattuple extension\u2026", "title": "The pgstattuple extension warrants page-state compatibility checks", "explanation": "contrib/pgstattuple/pgstatindex.c:321-325 classifies deleted, half-dead, and leaf pages through existing B-tree flags. New merge states require checking these classifications. The recommendation identifies a concrete compatibility dependency.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/contrib/pgstattuple/pgstatindex.c#L321-L325", "label": "REL_19_STABLE@16dd909023 \u00b7 contrib/pgstattuple/pgstatindex.c:321-325"}]}, {"anchor": "F8", "url": "https://pgtrue.postgres.ai/shared/brief/979078fd-6b1a-42ff-89f4-fbfd9d2f4443#F8", "claim": "When you delete records, it just marks them as deleted\u2026", "title": "SQL deletion records transaction information in the heap tuple", "explanation": "src/backend/access/heap/heapam.c:3059-3066 records the deleting transaction through tuple flags, xmax, and command information. This preserves the physical tuple for MVCC visibility checks before later cleanup.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/src/backend/access/heap/heapam.c#L3059-L3066", "label": "REL_19_STABLE@16dd909023 \u00b7 src/backend/access/heap/heapam.c:3059-3066"}]}, {"anchor": "F9", "url": "https://pgtrue.postgres.ai/shared/brief/979078fd-6b1a-42ff-89f4-fbfd9d2f4443#F9", "claim": "\u2026this is a B-tree WAL\u2026", "title": "WAL records identify their resource manager", "explanation": "src/include/access/xlogrecord.h:46-47 defines xl_info flags and the xl_rmid resource-manager identifier. The resource-manager registry connects identifiers to replay and description functions. These fields support the article's explanation of identifying and interpreting B-tree WAL records.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/src/include/access/rmgrlist.h#L37-L37", "label": "REL_19_STABLE@16dd909023 \u00b7 src/include/access/rmgrlist.h:37-37"}, {"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/src/include/access/xlogrecord.h#L46-L47", "label": "REL_19_STABLE@16dd909023 \u00b7 src/include/access/xlogrecord.h:46-47"}]}, {"anchor": "F11", "url": "https://pgtrue.postgres.ai/shared/brief/979078fd-6b1a-42ff-89f4-fbfd9d2f4443#F11", "claim": "That's why we have things like fillfactor\u2026", "explanation": "doc/src/sgml/ref/create_index.sgml:408\u2013415 says fillfactor controls B-tree leaf-page packing during initial builds and right-edge extension. A target below full capacity reserves space. This excerpt establishes neither a default percentage nor a merge threshold.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/doc/src/sgml/ref/create_index.sgml#L408-L415", "label": "REL_19_STABLE@16dd909023 \u00b7 doc/src/sgml/ref/create_index.sgml:408-415"}]}, {"anchor": "F12", "url": "https://pgtrue.postgres.ai/shared/brief/979078fd-6b1a-42ff-89f4-fbfd9d2f4443#F12", "claim": "\u2026It's been horizon pinned\u2026", "title": "Concurrent rebuilding can delay VACUUM cleanup on other tables", "explanation": "doc/src/sgml/ref/reindex.sgml:492-494 documents the effect on other tables. src/backend/commands/indexcmds.c:4239-4245 releases the validation snapshot before waiting for older snapshots. Cleanup interference depends on the active rebuild phase and concurrent row changes.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/doc/src/sgml/ref/reindex.sgml#L492-L494", "label": "REL_19_STABLE@16dd909023 \u00b7 doc/src/sgml/ref/reindex.sgml:492-494"}, {"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/src/backend/commands/indexcmds.c#L4239-L4245", "label": "REL_19_STABLE@16dd909023 \u00b7 src/backend/commands/indexcmds.c:4239-4245"}]}, {"anchor": "F14", "url": "https://pgtrue.postgres.ai/shared/brief/979078fd-6b1a-42ff-89f4-fbfd9d2f4443#F14", "claim": "\u2026Postgres has got this far without B-tree merge\u2026", "explanation": "src/backend/access/nbtree/nbtpage.c:1926\u20131934 rejects page deletion when data items remain. README:235\u2013239 contrasts empty pages with partly full page merging. The quoted README fragment does not establish the concurrent-scan explanation.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/src/backend/access/nbtree/nbtpage.c#L1926-L1934", "label": "REL_19_STABLE@16dd909023 \u00b7 src/backend/access/nbtree/nbtpage.c:1926-1934"}, {"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/src/backend/access/nbtree/README#L235-L239", "label": "REL_19_STABLE@16dd909023 \u00b7 src/backend/access/nbtree/README:235-239"}]}, {"anchor": "F16", "url": "https://pgtrue.postgres.ai/shared/brief/979078fd-6b1a-42ff-89f4-fbfd9d2f4443#F16", "claim": "\u2026the bottom-up deletion, that was Peter Geoghegan as well\u2026", "title": "The Peter Geoghegan attribution matches PostgreSQL 14 release notes", "explanation": "PostgreSQL 14 release notes credit Peter Geoghegan for deleting expired B-tree entries during insertion to prevent page splits. See doc/src/sgml/release-14.sgml:26805\u201326807.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/6b3806732b7c5df06bdd0ed150e8a07b4ad62315/doc/src/sgml/release-14.sgml#L26805-L26807", "label": "REL_14_24 \u00b7 doc/src/sgml/release-14.sgml:26805-26807"}]}, {"anchor": "F17", "url": "https://pgtrue.postgres.ai/shared/brief/979078fd-6b1a-42ff-89f4-fbfd9d2f4443#F17", "claim": "\u2026you fight bloat in 1 index and cause bloat everywhere in that database\u2026", "title": "Long-running reindexing can delay cleanup on other tables", "explanation": "REINDEX can restrict which tuples VACUUM removes from other tables. doc/src/sgml/ref/reindex.sgml:492\u2013494 documents that effect. Bloat growth requires concurrent obsolete-row accumulation. The statement describes a possible database-wide effect.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/16dd90902366c0404616dc43b170c94b064d0caf/doc/src/sgml/ref/reindex.sgml#L492-L494", "label": "REL_19_STABLE@16dd909023 \u00b7 doc/src/sgml/ref/reindex.sgml:492-494"}]}, {"anchor": "F21", "url": "https://pgtrue.postgres.ai/shared/brief/979078fd-6b1a-42ff-89f4-fbfd9d2f4443#F21", "claim": "\u20262 50% empty pages\u2026", "title": "The half-full-page example adds up", "explanation": "Two pages at 50% occupancy contain one page of data under the example's equal-capacity model (derived: 50% + 50% = 100%).", "verdict": "Accurate", "sources": []}, {"anchor": "F22", "url": "https://pgtrue.postgres.ai/shared/brief/979078fd-6b1a-42ff-89f4-fbfd9d2f4443#F22", "claim": "\u2026we needed 3 slots for logging\u2026", "title": "The listed merge logging operations total three", "explanation": "The description names one merge operation and two vacuum cleanup operations. Their total matches the stated three slots (derived: 1 + 2 = 3).", "verdict": "Accurate", "sources": []}]}