From the course: SQL Server Performance for Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

GUIDs vs. INT/BIGINT

GUIDs vs. INT/BIGINT - SQL Server Tutorial

From the course: SQL Server Performance for Developers

Start my 1-month free trial

GUIDs vs. INT/BIGINT

- [Instructor] GUIDs versus integers for primary keys in a database. This is a very common developer versus DBA argument. GUIDs or unique identifiers have the benefit of being globally unique across machines and databases. This gives us a tremendous benefit in that we know that we're always going to have a unique value. On the other hand, integers or BIGINTs are always going to perform better in join operations, and more importantly, take up a lot less space, and we'll talk about why that's going to matter as we go through this. What are GUIDs exactly? This is a globally unique identifier that a lot of people don't know, but it's composed partially of a seed that starts with the MAC address of the computer it's on, and then the time stamp where it was generated. So between those two things, they're able to ensure global uniqueness across systems. It is extremely, extremely rare that there are what are known as GUID collisions, where GUIDs have the same value in multiple systems. I've…

Contents