Global Unique IDs (GUIDs)
Global Unique IDs (GUIDs, sometimes referred to as universally unique identifiers or UUIDs) are 128-bit numbers used to identify digital information, helping to reference them unambiguously. They are similar to the ISBN numbers used for books.
Because they are so large, GUIDs are virtually guaranteed to be unique. They are formatted in a well-defined sequence of 32 hexadecimal digits grouped as 8-4-4-4-12. This provides roughly 10^38 numbers. An example of how a GUID looks in hexadecimal:
The probability of any two GUID's being the same is very low.
The general types of GUIDs are:
- Random: A random-number generator creates a 128-bit number.
- Time-based: Based on the current time.
- Hardware-based: Certain parts of the GUID are based on the hardware features, although this removes part of the anonymity of the number.
- Content-based: Based on a hash of the file contents. This can be used if duplicate files need to have the same GUID.
Some of the common uses for GUIDs are as follows:
- Unique primary key in databases (allowing database items to be merged without conflict).
- Unique filenames for uploaded files.
- Unique names for resources.
- Unique IDs for products.
- Unique IDs for design files or models.
The advantages of GUIDs are that there is no central authority, and so no need for management. GUIDs can be generated internally and merged from different data sources with a low chance of any conflict.
However, the GUID itself may be larger than the database item it is keeping track of.