Monday, July 6, 2009

Difference between Primary key and unique key?

Primary Key : Creates uniqueness for the column.And also creates clustered index on the column,by default

Unique Key :Creates uniqueness for the column.By default it creates a Non clustered index

To know more about Clustered index and non Clustered index.

Note : try to avoid using GUID as primaryKey (it will waste of your space (16 bytes)).If the database volume is high it will affect performance.if use int it will take less space(4 bytes).

0 comments:

 
Counter