Sql-server – Should I use Index or Unique Key for a non PK Uniqueidentifier

index-tuningsql server 2014uniqueidentifier

Using Sql Server 2014, I have several tables where the PK field is an int, but I also have a UniqueIdentifier field that I need to query by. This field will always be unique.

I am adding indexes for these and I have the option of choosing Index or Unique Key.

Is there any benefit to choosing one or the other?

Best Answer

Unique keys are indexes. If your values are guaranteed to be unique, this is the best choice.

Unique Key: Unique Key enforces uniqueness of the column on which they are defined. Unique Key creates a non-clustered index on the column. Unique Key allows only one NULL Value.