liveBook · Manning

Leaf node

As explained in Just Use Postgres!

A leaf node is a lowest-level tree node that contains index entries or references to stored records.

A leaf node is the lowest level of a B-tree index. It stores sorted index entries with references to the corresponding table records. section 4.1

Use leaf nodes to understand how an index search finishes and how ordered retrieval works:

  • Branch nodes direct the search toward the leaf containing the target entry. section 4.1
  • Leaf nodes link together in order, allowing range queries and ordered retrieval without navigating back up the tree. section 4.1

Finding ID = 5

A root entry of 10 directs the search to a branch containing 6 and 10. Entry 6 then points to a leaf containing 1, 4, 5, and 6, where the reference for ID = 5 is found. section 4.1

Figure 4.1 A sample B-tree index showing the search path to the index entry with ID = 5

Trace the root-to-branch-to-leaf search path for ID = 5 in the B-tree diagram. section 4.1

How Just Use Postgres! covers it

How deep it goes
Explains leaf placement, linked traversal, and logarithmic lookup cost without detailing storage implementation.
Examples
Uses a B-tree search for ID = 5 and a leaf containing entries 1, 4, 5, and 6.
What you can do after
Evaluate/understand how B-tree searches reach records and support range-oriented traversal.
How it connects
Connects leaf nodes to B-tree indexes, branch nodes, table records, range queries, and ordered data retrieval.

Also explained in

Compare how 10 books explain leaf node →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Just Use Postgres!. The section links point to the parts of the book it draws on.