SQL Server training and interview question:-What is index and how does it make your search faster ?.
Articles,  Blog

SQL Server training and interview question:-What is index and how does it make your search faster ?.

In this video will try to understand what exactly is a index and how does index makes such search text faster Lets try to understand what is the goal of index The only goal of a index or the only purposes of a index is to make you search faster How does index actually makes search faster Indexes makes a search faster by creating something called as a B-Tree structure or a Balanced Tree structure internally In this video first lets understand this theory of balanced tree structure Then we will see a practical demonstration of how index makes your search faster Before we start things practically First try to understand how data is searched when there are no indexes When you search data which are not indexed it searches sequentially On this video here if you want to search this value 50 the search engine or the SQL search engine It has to browse through all the records sequentially one by one until he reaches 50 value In lame person can easily identify this will have performance hits If you want to search this value 50 you have to browse throgh approximately 49 records If you want to increase your performance or if you want to increase your search performance then somehow we have to ensure this scanning of all the records we have to minimize it That’s what B-Tree structure or the Balanced Tree structure does When you index some data or when you index a column in SQL server It create this B-Tree Structure internally In the B-Tree structure data is divided into root nodes non leaf nodes and leaf nodes You can see how this data is divided at the root node we have 30 and 50 In the non-leaf nodes we have 10 and 29, we have 40 and 50 In each of this Non-leaf nodes we have leaf nodes where we have actual data The leaf nodes is actually pointing toward the actual data The searching will start from the root node Is 50=30 or


Leave a Reply

Your email address will not be published. Required fields are marked *