The database system uses B* trees for storing and accessing data. It creates B* trees for the following database objects:
· One B* tree for each table (primary data)
· One or more additional B* trees for tables with LONG columns (primary data)
· An additional B* tree for each index of a table (secondary data)
A B* tree consists of a root level, one or more B* tree index levels and a leaf level. Each level consists of one or more pages.
Example of a B* Tree with Three Levels
The pages of the root and B* tree index levels in a B* tree contain the separators. A separator points to the logical addresses (page numbers) of pages on the next lower level. The separator contains only the significant part of the primary key that is required to differentiate it from the next entry. In this way, the memory space that is required by these pages is minimized. The first separator in the far left page for each level (including the root level) contains only the pointer to the far left page on the next level down. The average length of the separators depends on the structure and selectivity of the key.
Example of a Leaf Page of a B* Tree
The pages of the leaf level (leaf pages) contain the actual data records (table rows) and a position list. Each data record has an entry in the position list that points to the physical location of the data record in the page. The database system stores the data records on a single page randomly, but it always stores the position entries in the position list in ascending order. The number of data records on a leaf page depends on the total length of the data records.
When the database system searches for a data record, it starts at the root level of the B* tree and narrows the search area step by step.
To determine the leaf page of a B* tree on which a certain data record is located, the database system uses the same search algorithm for all SELECT and DML statements.
See also: