What are the best practices for using a GUID as a primary key, specifically regarding performance? [closed]

I have an application that uses GUID as the Primary Key in almost all tables and I have read that there are issues about performance when using GUID as Primary Key. Honestly, I haven’t seen any problem, but I’m about to start a new application and I still want to use the GUIDs as the Primary Keys, but I was thinking of using a Composite Primary Key (The GUID and maybe another field.)

I’m using a GUID because they are nice and easy to manage when you have different environments such as “production”, “test” and “dev” databases, and also for migration data between databases.

I will use Entity Framework 4.3 and I want to assign the Guid in the application code, before inserting it in the database. (i.e. I don’t want to let SQL generate the Guid).

What is the best practice for creating GUID-based Primary Keys, in order to avoid the supposed performance hits associated with this approach?

9 Answers
9

Leave a Comment