Is Primary key clustered index different from Unique key clustered index??

  • My understanding is that SQL Server will use the primary key index in order to optimize the nonclustered indexes (I may be way off on this, so let's start with that assumption and if it is wrong, then we can just ignore the next part of the question).

    Going under the assumption that my previous statement is actually valid, then, if there isn't a primary key, but there is a clustered index, will the system use the clustered index as a reference in order to optimize the non-clustered indexes or is this functionality only associated with the 'primary key' index?

  • lorra (1/26/2012)


    My understanding is that SQL Server will use the primary key index in order to optimize the nonclustered indexes

    Nope. The primary key is totally irrelevant for anything to do with nonclustered indexes. The clustered index key is what is used as a pointer to the data row when the table has a clustered index.

    Clustered index != primary key.

    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

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Perfect. Thanks for the clarification.

  • When we are splitting hairs anyway, should I add we can have only one Primary Key (simple or composite) on a table? This limitation is not applicable to Unique Keys.

  • Please note the original thread is almost 2 years old.

    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

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • But it’s still active...

Viewing 6 posts - 31 through 35 (of 35 total)

You must be logged in to reply to this topic. Login to reply