"Unique Indexes" vs. "Unique Constraint"???

  • What the differense??? If any, what the cons and pros of each???

    Borik

    Your help is appreciated.

  • unique index:

    pro: speed up selects,DRI

    cons: slows updates, deletes, inserts as the index needs to be maintained, space used

    use : mostly if the fields are frequently searched upon

    unique constraint:

    pro: still maintains uniqueness, doesn't slow down updates/deletes/inserts

    no extra space used

    cons: selects aren't speeded up

    use :mostly if they just have to be unique

  • Are you sure about all that... AFAIK, constraint are also indexed and used in queries.

  • Unique constraints are enforced by the creation of a unique index.  There is no difference in either performance or functionality.  About the only difference is that if you just create a unique index it won't show up as a "constraint", but it still does the same thing.

    /*****************

    If most people are not willing to see the difficulty, this is mainly because, consciously or unconsciously, they assume that it will be they who will settle these questions for the others, and because they are convinced of their own capacity to do this. -Friedrich August von Hayek

    *****************/

  • Thanks for pointing that out.

Viewing 5 posts - 1 through 4 (of 4 total)

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