About Globally Unique Identifiers (GUIDs)

A GUID is a 128-bit number that is globally unique. The number has the following format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX. Even though the number is globally unique it can be generated without the need for a central registration authority.

Are GUIDs always unique?

The probability that a GUID will be duplicated is close to zero but it is possible. The number of random GUIDs which need to be generated in order to have a 50 % probability of at least one collision is 2.71 quintillion. This number is equivalent to generating 1 billion GUIDs per second for about 85 years and the probability so small that it can normally be ignored.

Who uses GUIDs?

Software engineers often use GUIDs as Identifiers. Computer systems can then use the number to identify information. For example two databases with tables that use GUIDs as their primary key could later be joined into a single database without conflict between identifiers.

Should you use GUIDs a primary Identifier?

In many cases GUIDs are good primary keys since they are unique and do not hold any information about the rows in the table. However, if your identifier only needs to be unique to your system there is no need to use a GUID. Some drawbacks to using GUIDs as an identifier is that the primary key is often indexed by the database. Since GUIDs are longer they could give worse performance than a simpler key. Another reason not to use a GUID would be if a user needs to remember the identifier, as often is the case with for example credit cards.

To summarize, consider other alternatives if:


Since there is a chance that GUIDs are not unique this site leaves no guarantee that the generated GUIDs are unique. Read about the probability of a GUID not being unique under Are GUIDs always unique.

More information on GUIDs

Read more about GUIDs on Wikipedia