Why does SQL Server add a 4 byte integer to non-unique clustered indexes

前端 未结 2 381
庸人自扰
庸人自扰 2020-12-20 01:08

It is possible to define non-unique columns as clustered as well as non-clustered indexes. However, SQL Server adds a 4 byte integer to the indexed columns in case of a clus

相关标签:
2条回答
  • 2020-12-20 01:54

    A non-clustered index already includes the clustered index column so it can reference the exact row that it correlates to. Hence with the uniquifier on the clustered index, the non-clustered index would also include the uniquifier.

    A good explanation here: Understanding and Examining the Uniquifier in SQL Server

    0 讨论(0)
  • 2020-12-20 01:57

    I believe this has to do with the row locator.

    Width of the nonclustered index row = Width of the nonclustered index column + Width of the clustered index column = size of column data type + size of column data type.

    0 讨论(0)
提交回复
热议问题