Alternative unique identifiers in a distributed environment

Your go-to forum for bot dataset expertise.
Post Reply
Fgjklf
Posts: 410
Joined: Tue Dec 24, 2024 3:21 am

Alternative unique identifiers in a distributed environment

Post by Fgjklf »

Universal Unique Identifier (UUID)
UUIDs are 128-bit long strings that can guarantee uniqueness in space and time. They are widely used to uniquely identify resources. There are several versions of UUIDs, each with a slightly different format. The most commonly used UUID version is version 4.


128-bit UUID-V4 string
The detailed specification of UUID can be found in RFC 4122 .

UUIDs in a distributed setup allow for uniqueness, but they are effective turkey mobile numbers list not so good for write performance and here's why.

UUIDs are random strings (in most versions) that have no particular order in a generation. When you use them for a clustered index column, they must be sorted and stored. Since they are not sorted (naturally during generation), more I/O is required to store them on the correct page, which could result in poor write performance on large tables, and could lead to issues such as index fragmentation since the data pages may not be in contiguous order.

Lexicographically classifiable universally unique identifier (ULID)
As the title suggests, ULIDs are universally unique but lexicographically sortable identifiers, this is primarily why it is better in write performance at scale compared to UUIDs. ULIDs are a relatively new form of identifiers and still lack widespread native support.

ULID is generated in 2 components:

1. Timestamp: 48-bit integer with UNIX time in milliseconds

2. Randomness: 80-bit random string


128-bit ULID string
In total, they are a unique string that is 128 bits long but lexicographically sortable. ULID is encoded using a combination of binary and base32 characters, resulting in a more compact 26-character format compared to the 36 characters generated by UUID v4.

More details about ULID can be found in its specification document .

Conclusion
Overall, we can conclude that ULIDs tend to have an advantage in write performance (in most cases) compared to UUIDs, specifically due to the lexicographically sortable nature of ULIDs.
Post Reply