Skip to main content

Indexing and Query Optimization

B+ Tree Indexes

0:00
LearnStep 1/2

B+ Tree

B+ Tree Index

The most common index structure in databases. Balanced tree optimized for disk access.

B+ Tree Structure

Properties

  • All leaves at same depth (balanced)
  • Internal nodes: Only keys, no data
  • Leaf nodes: Keys + data pointers
  • Leaves linked in sorted order

Search Operation

Range Query

sql

B+ Tree vs B-Tree

B+ TreeB-Tree
Data only in leavesData in all nodes
Leaves are linkedLeaves not linked
Better for range queriesMay be faster for single lookup
More fan-out (keys per node)Less fan-out