> [!tldr] **Universally Unique Identifier - a 128-bit identifier**
UUID stands for "Universally Unique Identifier". The idea is that it's a [[Surrogate Keys]] that function for _any_ element of _any_ table, resource, system, or whatever. It's **universal**.
It was developed my Microsoft, and is typically 128-bits. They are supported by Microsoft SQL Server, MySQL, PostgreSQL, MongoDB, and others.
There's also [[NanoID]], which I generally prefer.
# Format
There are ~~5~~ *eight* Versions of UUIDs. Some are random. Some are time-indexed. They are broken into 5 groups of **hexadecimal** characters, delimited by hyphens. Like so:
`123e4567-e89b-12d3-a456-426614174000`
What each of those hyphen-delimited groups _means_ depends on the version of the UUID.
From the *ntietz* source directly - because its' great.
> - [UUID Version 1 (v1)](https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-1) is generated from timestamp, monotonic counter, and a MAC address.
> - [UUID Version 2 (v2)](https://datatracker.ietf.org/doc/html/rfc9562#name-uuid-version-2) is reserved for security IDs with no known details[[2]](https://www.ntietz.com/blog/til-uses-for-the-different-uuid-versions/#fn-dce).
> - [UUID Version 3 (v3)](https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-3) is generated from MD5 hashes of some data you provide. The RFC suggests DNS and URLs among the candidates for data.
> - [UUID Version 4 (v4)](https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-4) is generated from entirely random data. This is probably what most people think of and run into with UUIDs.
> - [UUID Version 5 (v5)](https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-5) is generated from SHA1 hahes of some data you provide. As with v3, the RFC suggests DNS or URLs as candidates.
> - [UUID Version 6 (v6)](https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-6) is generated from timestamp, monotonic counter, and a MAC address. These are the same data as Version 1, but they change the order so that sorting them will sort by creation time.
> - [UUID Version 7 (v7)](https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-7) is generated from a timestamp and random data.
> - [UUID Version 8 (v8)](https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-8) is entirely custom (besides the required version/variant fields that all versions contain).
****
# More
## Source
- [Universally unique identifier - Wikipedia](https://en.wikipedia.org/wiki/Universally_unique_identifier)
- https://www.ntietz.com/blog/til-uses-for-the-different-uuid-versions/
## Related
- [[SysML]]
- [[Primary Key]]
- [[Surrogate Keys]]
- [[UUIDs in the Wild]]