Unique Index or Constraint

  • Hi,

    Does anyone know the difference between a unique Index and a unique constraint??, and it which situations they are best suited??

    BOL does not seem too clear on this!!!

     


    Thanks Jeet

  • Constraint does duplication the check before insert, unique index does as insert is occurring. This means in the first there are two actions on the index, seeks if dupe found errors, locks and inserts. The other locks and inserts but if dup occurrs will error. Not sure if the clustered has to rifind the index position for insert or not but I assume it does in case someone inserts somewhere else. If the index is a big factor in inserts make a constraint if not then (such as a readonly table) a unique index will serve fine.

Viewing 2 posts - 1 through 2 (of 2 total)

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