sql-serverindexingclustered-indexnon-clustered-indexquery-tuning

SQL Server - When to use Clustered vs non-Clustered Index?


I know primary differences between clustered and non clustered indexes and have an understanding of how they actually work. I understand how clustered and non-clustered indexes improve read performance. But one thing I am not sure is that what would be the reasons where I would choose one over the other.

For example: If a table does not have a clustered index, should one create a non-clustered index and whats the benefit of doing


Solution

  • I just want to put in a word of warning: please very carefully pick your clustered index! Every "regular" data table ought to have a clustered index, since having a clustered index does indeed speed up a lot of operations - yes, speed up, even inserts and deletes! But only if you pick a good clustered index.

    It's the most replicated data structure in your SQL Server database. The clustering key will be part of each and every non-clustered index on your table, too.

    You should use extreme care when picking a clustering key - it should be:

    Anything else should really be second and third level of importance behind these points ....

    See some of Kimberly Tripp's (The Queen of Indexing) blog posts on the topic - anything she has written in her blog is absolutely invaluable - read it, digest it - live by it!