Results 1 to 3 of 3
  1. #1
    Join Date
    May 2012
    Posts
    4

    Unanswered: Performance Issue With UNIQUE CONSTRAINT

    Hi Does adding a UNIQUE CONSTRAINT to a column increase/decrease the performance/speed?

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Adding the constraint improves performance by preventing bad data. This allows the DBA to get more sleep, and therefor perform better.

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

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    a UNIQUE constraint will slow down inserts and deletes (and updates that change the value of that colulmn)

    however, i'll bet you a beer you won't be able to measure the difference

    on the plus side, the UNIQUE constraint has the potential to dramatically improve performance for all queries which search on that column, if there was no index defined before
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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