INCLUDE columns
As we mentioned earlier, clustered indexes contain all the columns in the table because the data pages reside at the leaf level of the index. A non-clustered index on the other hand contains only columns that are part of the index definition. We have discussed some guidelines for choosing key columns for non-clustered indexes, but non-clustered indexes can contain another type of column called an included column. An included column is one that is added to the non-clustered index simply to make it a covering index—an index which contains all the columns necessary to satisfy the query without accessing the base table. Included columns are used to add columns that aren't used for filtering or joining, such as those in the SELECT ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access