Primary Keys

  • Comments posted to this topic are about the item Primary Keys


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St

  • Nice easy unambiguous question.

    A restful finish to to the week (for some), and a pleasant start to the week for others.

    Published a little before its time, I guess, as it's the day after tomorrow's question. πŸ˜›

    Tom

  • L' Eomot InversΓ© (7/28/2012)


    Nice easy unambiguous question.

    A restful finish to to the week (for some), and a pleasant start to the week for others.

    Published a little before its time, I guess, as it's the day after tomorrow's question. πŸ˜›

    Nah just right if you use that unsupported command DBCC TIMEWARP

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • Index has the limitation of 16 key columns, primary key can be either clustered or non-clustered. So it can also have only 16 columns. I guessed the answer as above.

    πŸ™‚

    [font="Verdana"]Regards,
    Rals
    [/font].
  • Tom, Bitbucket and Rals - Thanks for dropping by and giving it a shot.

    I believe that the limitation on columns participating in an INDEX is the same as for the primary key, so you were right to guess that Rals.


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St

  • Easy one for Monday, thanks!

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Than you for the good week start.........!!!

  • Got it wrong as there's no mention of a limit in the Primary Key or Create Table sections of BOL.

    Anyone who even approaches the limit should be sent on a training course anyway πŸ™‚

  • I was pretty sure of the answer but went to check just to be absolutely sure because I've never gotten close to the limit. It just absolutely fascinates me that this little bit of very important "trivia" ISN'T covered under the constraints, primary key, or CREATE TABLE sections of BOL.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • This was removed by the editor as SPAM

  • Jeff Moden (7/30/2012)


    I was pretty sure of the answer but went to check just to be absolutely sure because I've never gotten close to the limit. It just absolutely fascinates me that this little bit of very important "trivia" ISN'T covered under the constraints, primary key, or CREATE TABLE sections of BOL.

    Same reaction, both to the question and BOL. Also, wasn't there a recent question that was tangentially related to this? Something about large data types in an index?

    [font="Verdana"]Please don't go. The drones need you. They look up to you.[/font]
    Connect to me on LinkedIn

  • Great question. Had to use MSDN to confirm my answer but will never forget it now.

  • +1

    Cheers,

    Steve

  • Thanks for the question!

    This page shows the limit for primary key columns:

    http://msdn.microsoft.com/en-us/library/ms143432.aspx

Viewing 15 posts - 1 through 15 (of 27 total)

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