开发者

SQL Server Indexes - Non-Clustered Index on HEAP

开发者 https://www.devze.com 2023-04-10 20:41 出处:网络
We have got 221gb table in our SQL Database, mainly duplicate data. Team has created NON-CLUSTERED index on HEAP. Does really this help in terms of performan开发者_如何转开发nce?

We have got 221gb table in our SQL Database, mainly duplicate data.

Team has created NON-CLUSTERED index on HEAP. Does really this help in terms of performan开发者_如何转开发nce?

Should we put IDENTITY column in table and then create CLUSTERED index AND after that we can create NON clustered indexes.


It Depends

On the usage pattern and structure of the data.

Is the non-clustered index covering?

Is the data in the table ever changing?

A heap table with a non-clustered index (or indexes) which are covering can outperform a clustered index where the clustered index is the only "index" (a clustered index is obviously always covering, but may not be optimal for seeks)

Remember a clustered index is not an index (in the sense of a lookup based on a key into a location where the data is stored), it's the whole table organized by a choice of index. In a real (non-clustered) index, only the keys and included columns are included in the index and this means that (generally) more rows can be stored per database page and less data is read unnecessarily.

Most tables should have a clustered index, but the choice of non-clustered indexes is where most of your performance comes from.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号