B+ Tree Index

What
A B+ tree index is a tree based index that has the special feature of keeping the tree height balanced on insertion and deletes

Characteristics

 * Each node in the tree has $$m$$ entries, where $$d <= m <= 2d$$. $$d$$ is called the order of the tree and it represents the minimum occupancy each node can have.

Details

 * Big difference vs ISAM is that the tree structure is dynamic
 * The + in the name means that it is a special kind of B tree in which all of the data is in the leaves

Insertion
Inserting L into the B+ tree
 * 1) Find the correct page by searching the B+ tree
 * 2) If there is enough space, add L to the data node
 * 3) If there is not enough space, split the data node and copy up the middle node to the parent of the data node to the newly split node. Keep a copy of the middle node in one of the two split nodes
 * 4) The process can happen recursively, if we are splitting the root, then we push up the middle key

Deletion
Deleting L from the B+ tree
 * 1) Find the correct page by searching the B+ tree
 * 2) Delete the value
 * 3) If there is d-1 values, try to borrow from sibling.
 * 4) If borrowing fails (because sibling only has d elements), we must merge with the sibling and delete the entry in the parent pointing to either the page or its sibling

Cost
The cost of insertion is the number of nodes read by the search plus 1 for the write