B-Trees, Page Layout, and Fan-Out

Estimate the branching factor of a page-oriented index and follow how a split propagates separator keys.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Fit many decisions in a page
  2. Splits preserve the partition of the key space

Fit many decisions in a page

A B-tree node contains sorted separators and child pointers. After fetching one page, search within it to choose the child whose interval contains the key. With 4096 bytes, 128 bytes reserved for headers, and roughly 16 bytes per separator–pointer pair, about 248 pairs fit before slot metadata or variable key sizes. The exact format can use another child pointer and compress keys. Higher occupancy increases fan-out and reduces the number of external-memory transfers along the search path.

Splits preserve the partition of the key space

Inserting into a full node may split it into two occupied pages. The parent receives a separator covering the boundary and a pointer to the new page. A parent split can propagate to the root, where a fresh root adds one level. B+ trees store data records or record references at the leaf level. Linked leaves then support sequential range scans. Index-only scans and page reclamation depend on the exact leaf payload and lifetime rules.[1]

References

  1. MIT OpenCourseWare, Design and Analysis of Algorithms: Lecture Notes ↩