Answered by:
Can you please differentiate blw Unique Clustered Index and Non Unique Clustered Index.

Question
-
Can you please differentiate b/w the following:
Unique Clustered Index
Non Unique Clustered Index
and explain what are these?Thanks,
Nagaraju K.
- Edited by Raj. K Thursday, March 15, 2012 7:23 AM
Wednesday, March 14, 2012 4:26 PM
Answers
-
the difference is that the index key is unique for one and not for the other. In the case of a non-unique key, sql server has to create a unique key by appending some other values to the key. This adds additional overhead for both performance and storage. Additonally SQL Server could pontentially use a less efficient query plan for queries becuase it doesnt know the key used in the predicate is unique. Always use a unique index where available, as this will help to optimize performance, save storage, and gives you insight into the data without querying the table.
Wednesday, March 14, 2012 4:57 PM
All replies
-
Hi
Check below link
http://sqlserverpedia.com/blog/sql-server-bloggers/unique-and-non-unique-non-clustered-indexes-on-a-unique-clustered-index/
KaydenWednesday, March 14, 2012 4:40 PM -
the difference is that the index key is unique for one and not for the other. In the case of a non-unique key, sql server has to create a unique key by appending some other values to the key. This adds additional overhead for both performance and storage. Additonally SQL Server could pontentially use a less efficient query plan for queries becuase it doesnt know the key used in the predicate is unique. Always use a unique index where available, as this will help to optimize performance, save storage, and gives you insight into the data without querying the table.
Wednesday, March 14, 2012 4:57 PM -
UNIQUE CLUSTERED INDEX is typically used for PRIMARY or UNIQUE KEYs. It is helpful with range searches among others.
NON-UNIQUE CLUSTERED INDEX must have a very limited application role, I never used it.
Related article:
http://www.sqlusa.com/bestpractices2008/allindexes/
Kimberly Tripp on the topic: "
Let's start with the key things that I look for in a clustering key:
* Unique
* Narrow
* Statichttp://stackoverflow.com/questions/4332982/do-clustered-indexes-have-to-be-unique
Kalman Toth SQL SERVER & BI TRAINING
- Edited by Kalman Toth Tuesday, March 20, 2012 8:51 PM
Tuesday, March 20, 2012 8:40 PM