Primary Key Index and Primary Key with Clustered Index

  • Thanks Gail.

    But In an interview I was asked, how can I create a PK column without any index?

    I responded that this is not possible as SQL Server automatically creates Clustered Index unless Non-Clustered is applied.

    But I think that he was satisfied by this answer.

    -Manoj

  • manub22 (8/23/2010)


    But In an interview I was asked, how can I create a PK column without any index?

    You can't. Primary keys have to be unique and the way SQL enforces that uniqueness is with an index. You can chose between clustered and nonclustered, but there has to be an index there.

    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
  • Hello Gail, I was going through the article. Its interestin topic as PKs and clustered indexes are the big factors for performance tuning.

    I've a situation. I've one bg table A which is been used in one query having join with another big table B. Table A has no Primary key but a clustered index defined on four columns (composite) and two more nonclustered indexes. While running the query, its taking too much time and execution plan shows 23% of sort on one column of table A which is part of clustered index. How should I resolve it ?

  • Please post your question in a new thread and include the query, table definitions, index definitions and execution plan.

    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

Viewing 5 posts - 16 through 19 (of 19 total)

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