August 30, 2009 at 5:18 am
I have a table with the primary key on two columns (CLIENT_ID and APPOINTMENT_NUMBER).
Most of the queries against the table will be only involve CLIENT_ID in the WHERE clause. APPOINTMENT_NUMBER has only been used in the PK to identify the record as unique.
I'm not clear on how composite PKs work, so I was wondering would there be any performance benefit for SELECT queries if I added an additonal index to just the CLIENT_ID?
Or will the composite PK already have it covered?
August 30, 2009 at 10:38 am
None whatsoever, providing ClientID is the leading column in the index.
http://sqlinthewild.co.za/index.php/2009/01/19/index-columns-selectivity-and-equality-predicates/
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply