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. Figure 1 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.