Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2012
    Posts
    33

    Unanswered: primary key clustered

    Hello

    I have a question.

    Is good practice use primary key clustered on every table on database?I'm going to use replication database and it is very important that data not have repeat.

    I greet.

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    PRIMARY KEY is very important... CLUSTERED is a different issue and may or may not be applicable.

    PRIMARY KEY is a logical issue, declaring which of the possible ALTERNATE KEY values the database architect deems to be the "primary" key for that table. This is what enforces uniqueness, which is important for logical design and crucial for replication.

    CLUSTERED determines what controls the order of rows within the table storage. Depending on your schema design, the order of the rows can have trivial or massive effect on the database query performance.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Jan 2013
    Posts
    354
    Provided Answers: 1

    Save the cluster for the important stuff

    Any PRIMARY KEY will assure uniqueness. A clustered index is best used for columns that you use for aggregations or sequences enough of the time to justify it.

  4. #4
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    I would add that any large transactional table should have a clustered index, otherwise the scattered disk IO will kill application performance.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •