From the course: Advanced SQL for Application Development

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Using B-tree indexes and range scans

Using B-tree indexes and range scans

From the course: Advanced SQL for Application Development

Start my 1-month free trial

Using B-tree indexes and range scans

- [Instructor] Let's take a look at B-tree or balanced tree indexes. These are widely used in the kinds of applications that we have been discussing. As the name implies, the B-tree index is a tree data structure with a root, and then several nodes below that. The tree is balanced because the root node is the index value that splits the range of values found in the index column. So for example, if an index column had values from one to 100, then the root would be 50 or close to 50 if there wasn't a 50 in the column. Each side of the tree has a subtree. The top node of the subtree splits the values of the index column so that the values less than the node value are stored to the left branch, and the value is greater than the value of the node are stored in the right. This pattern continues at each level of the tree until we reach the bottom. Now, in this example, the B-tree has 11 nodes storing the values of the…

Contents