A B+ tree is an
m-ary tree with a variable but often large number of children per node. A B+ tree consists of a root, internal nodes and leaves.
The root may be either a leaf or a node with two or more children.
A B+ tree can be viewed as a
B-tree
In computer science, a B-tree is a self-balancing tree data structure that maintains sorted data and allows searches, sequential access, insertions, and deletions in logarithmic time. The B-tree generalizes the binary search tree, allowing fo ...
in which each node contains only keys (not key–value pairs), and to which an additional level is added at the bottom with linked leaves.
The primary value of a B+ tree is in storing data for efficient retrieval in a
block-oriented storage context—in particular,
filesystems. This is primarily because unlike
binary search tree
In computer science, a binary search tree (BST), also called an ordered or sorted binary tree, is a Rooted tree, rooted binary tree data structure with the key of each internal node being greater than all the keys in the respective node's left ...
s, B+ trees have very high fanout (number of pointers to child nodes in a node,
typically on the order of 100 or more), which reduces the number of I/O operations required to find an element in the tree.
History
There is no single paper introducing the B+ tree concept. Instead, the notion of maintaining all data in leaf nodes is repeatedly brought up as an interesting variant of the B-tree, which was introduced by R. Bayer and E. McCreight.
Douglas Comer notes in an early survey of B-trees (which also covers B+ trees) that the B+ tree was used in IBM's
VSAM data access software, and refers to an IBM published article from 1973.
Structure
Pointer structure
As with other trees, B+ trees can be represented as a collection of three types of nodes: ''root'', ''internal'' (a.k.a. interior), and ''leaf''. In B+ trees, the following properties are maintained for these nodes:
* If
exists in any node in a B+ tree, then exists in that node where
.
* All leaf nodes have the same number of ancestors (i.e., they are all at the same depth).
The pointer properties of nodes are summarized in the tables below:
* : Maximum number of potential search keys for each node in a B+ tree. (this value is constant over the entire tree).
* : The pointer at the zero-based node index .
* : The search key at the zero-based node index .
Node bounds
The node bounds are summarized in the table below:
Intervals in internal nodes

By definition, each value contained within the B+ tree is a key contained in exactly one leaf node. Each key is required to be directly
comparable with every other key, which forms a
total order
In mathematics, a total order or linear order is a partial order in which any two elements are comparable. That is, a total order is a binary relation \leq on some set X, which satisfies the following for all a, b and c in X:
# a \leq a ( re ...
.
This enables each leaf node to keep all of its keys sorted at all times, which then enables each internal node to construct an ordered collection of
intervals representing the contiguous extent of values contained in a given leaf. Internal nodes higher in the tree can then construct their own intervals, which recursively aggregate the intervals contained in their own child internal nodes. Eventually, the root of a B+ Tree represents the whole range of values in the tree, where every internal node represents a subinterval.
For this recursive interval information to be retained, internal nodes must additionally contain
copies of keys
for