Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which is the most common ID type in SQL Server databases, and which is better?

Is it better to use a Guid (UniqueIdentifier) as your Primary/Surrogate Key column, or a serialized "identity" integer column; and why is it better? Under which circumstances would you choose one over the other?

like image 734
Nate Avatar asked Dec 22 '09 19:12

Nate


1 Answers

Use a GUID in a replicated system where you need to guarantee uniqueness.

Use ints where you have a non-replicated database and you want to maximise performance.

like image 88
flesh Avatar answered Oct 12 '22 22:10

flesh