From the course: Advanced SQL for Query Tuning and Performance Optimization

Unlock the full course today

Join today to access over 23,400 courses taught by industry experts.

B-tree indexes

B-tree indexes

- [Instructor] Let's turn our attention to balanced tree, or B-tree, indexes. As the name implies, the B-tree index is a tree data structure with a root and nodes. The tree is balanced because the root node is the index value that splits the range of values found in the index column. For example, if an index column has values from one to 100, then the root would be 50, or close to 50 if there isn't a 50 in the column. Each side of the tree has a subtree. The top node of the subtree splits the value of the index column so that the values less than the node value are stored to the left branch of the tree, and values greater than the value in the node are stored to the right. This pattern continues at each level of the tree until we reach the bottom. In this example, the B-tree has 11 nodes storing values of the index column of a table with 11 rows. B-trees make for efficient lookups because we can always determine…

Contents