Creation of Root and Leaf Nodes
When you create an index for an empty table, the database server allocates a single index page. This page represents the root node and remains empty until you insert data in the table.
At first, the root node functions in the same way as a leaf node. For each
row that you insert into the table, the database server creates and inserts
an index item in the root node. Root Node illustrates
how a root node appears before it fills.
When the root node becomes full
of index items, the database server splits the root node by performing the
following steps:
- Creates two leaf nodes
- Moves approximately half of the root-node entries to each of the newly created leaf nodes
- Puts pointers to leaf nodes in the root node
As you add new rows to a table, the database server adds index items to the leaf nodes. When a leaf node fills, the database server creates a new leaf node, moves part of the contents of the full index node to the new node, and adds a node pointer to the new leaf node in the root node.
For example, suppose that leaf node 3 in Leaf Node
4 Created After Leaf Node 3 Fills becomes full. When this situation occurs, the database server
adds yet another leaf node. The database server moves part of the records
from leaf node 3 to the new leaf node, as Leaf Node
4 Created After Leaf Node 3 Fills shows.