To store data so that it is structured, the database system uses B* trees. Data Access Using a B* Tree is more efficient than other methods such as sequential scanning. Undo information is not stored in B* trees, nor are C++ objects that are made persistent in liveCache database instances; the database system uses page chains.
The database system 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 levels in a B* tree contain the separators. A separator points to the logical addresses (page numbers) of pages in the next level down. 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 storage space that is required by these pages is minimized. The first separator on 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.
The pages of the leaf level contain the actual data records (table rows) and a position list. Each table row has an entry in the position list, which points to the physical location of the table row in the page. The table rows are stored unordered within a page, although the position lists are always sorted in ascending order. The number of entries on a page depends on the total length of the table rows. The pages are sorted in ascending order from left to right.
The database system automatically rebalances the B* trees, thereby making it unnecessary to reorganize the data manually.
You can check the consistency of the B* trees. See Checking the Database Structures.