Fish Touching🐟🎣

B+-Tree

Apr 3, 2023

# Overview

# Insertion

  1. Have enough space
    1. Find the right leaf.
    2. Perform Sort in the leaf.
  2. Do not have enough space
    1. Split leaf if there is not enough room
    2. Redistribute entries evenly (d entries in left and $d+1$ entries in right)
    3. Fix next/prev pointers
    4. Copy up from leaf the middle key (Left most key in right leaf)
    5. If no room in parent
      1. Recursively split index nodes
      2. Redistribute the rightmost d keys to make them split evenly
      3. Push up middle key (Left most in index node)
      4. Sort

# Bulk Loading (Inserting)

Only happens on B+-Tree creation.
Indexes built from bulk loading always start off clustered because the underlying data is sorted on the key
Do not insert key one by one, instead, insert node and link them through navigation node.

# Deletion

# Storing Data

# Clustering (How data on the data pages are organized)

Clustered and unclustered indexes refer to how data pages are structured in a B+ tree. In a clustered index, the data pages are sorted on the same index on which the B+ tree is built, while in an unclustered index, the data pages are not sorted. Clustered indexes can be more efficient for range searches and offer potential locality benefits during sequential disk access and prefetching, but they are usually more expensive to maintain than unclustered indexes
image.png
image.png