 Hello, welcome to SSHiritech, so since this side and this is continuation of SQL Server performance training. This is part 7 of SQL Server performance training and today we gonna discuss about Btree. So what is Btree and how it looks like. So go to our next slide to understand about the Btree. So when we create any index, it could be cluster index or non cluster index, then data pages are arranged in a logical order and that order would be called as Btree structure. If table doesn't have any index, then data are stored as a heap and heap doesn't have any structure. Basically the data pages are spread into three nodes. First is root node, then intermediate node, then leaf node and data are stored into leaf node. How data would be arranged in Btree once we will create the cluster index. So go to our next slide. So here as we can see we have root node, then intermediate node and leaf node. So data would be stored in leaf node only. So here as we can see, so once we gonna create the cluster index, then our data would be stored like this. So here we gonna store the data for 1 to 500. So our root node would be 1 to 500, then it would be divided into two parts. In left side it would contain first to 250 and in right side it would contain 250 to 500. Then again it will divide into two parts 1 to 125 and 126 to 250. So this is the structure basically once we gonna create the cluster index. So here if we will search for 126, then first it will start from the root node. So it will get left side will have the 126, then go to on intermediate node, then move to 1 to 150. So this is our second scan, then it will check 126 is available on right side. So it will goes to this and again 126 is available on the left side. So it will goes to this. So it will scan only four scans. This is our first scan, then second, then third and then fourth. So by using cluster index if we will scan, then only four scans will be done and we will get the data. That's why we need to create the indexes in the table. Let's move to next slide to understand about the once we will create the non-cluster index then how data will be stored. So this is our non-cluster index. As we can see below in this image this is our cluster index and it will have root node, intermediate node and leaf level node. So basically here we have three type of nodes as we have discussed in cluster index. So once we will create the non-cluster index then it will arrange the data in B3 as well but it will separate from the table. So this is our table and this is our non-cluster index. So here it will have the data up to 200. So as we can see if we will search for 51 that is Mary then it goes to left side because data is available on the left side then 50% of scan will be reduced in our first search. Then it will go to right side because 51 Mary is available on the right side. Once we will reach the Mary as we know we have the cluster index. So it will get the cluster row ID for the 51 that is Mary. So it will directly move to the Mary and get the record from the cluster index that is our table. So this is the structure for non-cluster index. So thank you so much for watching this video. If you like this video please subscribe our channel to get many more videos. Don't forget to press the bell icon to get the notification of our newly uploaded videos and please share to others. Thank you so much.