Unique Constraint vs Unique Index

This MSDN article comparing the two is for SQL Server 2000: http://msdn.microsoft.com/en-us/library/aa224827(SQL.80).aspx

For most purposes, there’s no difference – the constraint is implemented as an index under the covers. And though there’s the ability to disable the constraint, it doesn’t actually work in SQL Server.

It only matters if you want to tweak things like FILLFACTOR, etc for which way you want to implement the unique constraint.

SQL Server 2008+ added INCLUDE to provide more efficient covering indexes. Filtered indexes = unique constraint over a subset of rows/ignore multiple null etc.

Leave a Comment

bahis casinocanlı casino siteleritürkçe altyazılı pornocanlı bahis casino