A Universally Unique Identifier (UUID) is a 128-bit number used to identify information in computer systems. The number of possible UUIDs is 16^32, which is 2^128 or about 3.4x10^38 (which is a lot!).
A UUID (Universally Unique Identifier) is a 128-bit identifier used to uniquely identify information in distributed systems. There are approximately 5.3 × 10²² possible UUIDs in version 4.
UUID v1 is time-based and includes the machine's MAC address, making it predictable but sequential. UUID v4 is randomly generated and is the most common choice for general use.
UUID v4 is completely random with no ordering, making it ideal for most use cases. UUID v7 (newer RFC 9562) is time-ordered, embedding a millisecond timestamp prefix for database-friendly sorting. If you need sortable unique IDs with time ordering for database primary keys, consider UUID v7 or ULID as modern alternatives to v4.
UUID v4 is completely random and widely supported, suitable for most global unique ID use cases. UUID v7 (standardized in 2023) includes a timestamp prefix, making it naturally time-ordered — more B-tree index friendly (fewer page splits, better insert performance) while retaining sufficient randomness to prevent collisions. New projects should consider UUID v7 or ULID for database primary keys. Existing systems using v4 do not need to migrate.