Primary Keys: IDs versus GUIDs

Every wonder if you should create primary keys in a database as IDs or GUIDs?

March 21st, 2007 • Develop •
0 (0 votes)

Developers share a lot of building duties when building applications for users including create database structures.

If you've been building databases for a while, you may run across developers who create primary keys as IDs or GUIDs, but which is better?

Jeff Atwood on my favorite blog, Coding Horror, talks about which is better to use for primary keys: IDs or GUIDs. Personally, I've been using IDs for the longest time and been on the fence about GUIDs for a while. As stated in the post, It is 16 bytes and I've been talked to about it by DBAs before because it was taking up a lot of space.

Was this informative? Share it!

Looking to become a better developer?

Sign up to receive ReSharper Design Pattern Smart Templates, ASP.NET MVC Guidelines Checklist, and Newsletter Updates!

Picture of Jonathan Danylko

Jonathan Danylko is a freelance web architect and avid programmer who has been programming for over 20 years. He has developed various systems in numerous industries including e-commerce, biotechnology, real estate, health, insurance, and utility companies.

When asked what he likes to do in his spare time, he replies, "Programming."

comments powered by Disqus