By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,970 Members | 1,669 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,970 IT Pros & Developers. It's quick & easy.

Clustered Index example of exception to the rule

P: 3
Per my research the ideal clustered index should be a narrow column and unique. We are currently on SQL Server 2012 and have a database setup for merge replication. I am in the process of adding a new table, StoreOPenDocuments, to our database. I am unsure what the clustered index should be.

Table StoreOpenDocuments
StoreOpenDocumentsID defined as UniqueIdentifier
CustomerID defined as UniqueIdentifier

Table MemberShipList (existing table)
CustomerID defined as UniqueIdentifier

Would it make sense to make the StoreOpendocuments.CustomerID the clustered index even though it is not unique and is done on a UniqueIdentifier column?
Majority of our select statements will have where CustomerID = XXX
Or should I have the StoreOpenDocumetnsID be the clustered index, at least it is unique.

Thank you in advance for your time,
Apr 8 '16 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 10K+
P: 12,430
Clustered indexes are typically used to store rows in a table in a certain order to reduce the cost of a sort in a query. For the most part, it looks like you're just filtering or joining on the customer id so there's no need for a clustered index. Just create a regular index on it.
Apr 11 '16 #2

Post your reply

Sign in to post your reply or Sign up for a free account.