Can someone explain these two – Index Key Column VS Index Included Column?
Currently, I have an index that has 4 Index Key Columns and 0 Included Columns, and I’d like to know the difference between the two.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Index key columns are part of the b-tree of the index. Included columns are not.
Take two indexes:
index1is better suited for this kind of query:Whereas
index2is better suited for this kind of query:In the first query,
index1provides a mechanism for quickly identifying the rows of interest. The query will (probably) execute as an index seek, followed by a bookmark lookup to retrieve the full row(s).In the second query,
index2acts as a covering index. SQL Server doesn’t have to hit the base table at all, since the index provides all the data it needs to satisfy the query.index1could also act as a covering index in this case.If you want a covering index, but don’t want to add all columns to the b-tree because you don’t seek on them, or can’t because they aren’t an allowed datatype (eg, XML), use the INCLUDE clause.