简体   繁体   中英

SQL Server Indexes - Non-Clustered Index on HEAP

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 performannce?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM