Our data resides in a SQL Server 2008 database, there will be a lot queries and joinings between tables. We have this argument inside the team, some are arguing use of integer identity is better for performance, some are arguing use of guid (unique identifier).
Does the performance really suffer that badly using a GUID as a primary key?
A 128-bit GUID (
uniqueidentifier) key is of course 4x larger than a 32-bitintkey. However, there are a few key advantages:SELECTfrom the primary key based on a date/time range if you want with a few fancyCAST()calls.SELECT scope_identity()to get the primary key after an insert.bigint(64 bits) instead ofint. Once you do that,uniqueidentifieris only twice as big as abigint.In the end, squeezing out some small performance advantage by using integers may not be worth losing the advantages of a GUID. Test it empirically and decide for yourself.
Personally, I still use both, depending on the situation, but the deciding factor has never really come down to performance in my case.