Your Ad Here

Feb 15, 2008

What are B-Trees?

Most of the indexing fundamentals use “B-Tree” or “Balanced-Tree” principle. It’s not a principle that is something is created by SQL Server but is a mathematical derived fundamental.
Above is a sample diagram which explains how B-Tree fundamental works. The above
diagram is showing how index will work for number from 1-50. Let’s say you want to search 39.

SQL Server will first start from the first node i.e. root node.
√ It will see that the number is greater than 30, so it moves to the 50 node.
√ Further in Non-Leaf nodes it compares is it more than 40 or less than 40. As

it’s less than 40 it loops through the leaf nodes which belong to 40 nodes.
You can see that this is all attained in only two steps…faster aaah. That is how exactly indexes work in SQL Server.

No comments: