Non-Clustered Index on a Clustered Index column improves performance?

后端 未结 3 850
南旧
南旧 2021-02-14 14:16

In SQL Server 2005, the query analyzer has told me many times to create a non-clustered index on a primary ID column of a table which already has a clustered index. After follo

3条回答
  •  感动是毒
    2021-02-14 14:47

    A clustered index has all the data for the table while a non clustered index only has the column + the location of the clustered index or the row if it is on a heap (a table without a clustered index). So if you do a count(column) and that column is indexed with a non clustered index SQL server only has to scan the non clustered index which is faster than the clustered index because more will fit on 8K pages

提交回复
热议问题