Hasty Briefsbeta

  • #UUIDv7
  • #Database
  • #Distributed Systems
  • UUIDv7 is a 128-bit identifier inspired by ULID, containing a timestamp and random data.
  • UUIDv7 is preferred over other identifier types like UUIDv4, ULID, and Snowflake ID in databases and distributed systems.
  • RFC 9562 sets requirements for UUIDv7, including the use of a cryptographically secure pseudorandom number generator (CSPRNG).
  • UUIDv7 implementations offer various field and bit layouts to ensure monotonicity, even with clock rollbacks.
  • Monotonicity can be ensured using counters, mutexes, or sub-millisecond timestamp segments, with server-side generation providing better results.
  • Extracting timestamps from UUIDv7 is not recommended; explicit timestamp columns are preferred.
  • UUIDv7 can be used as a partitioning key in databases.
  • Timestamp shifting in UUIDv7 helps hide creation dates, prevent lock contention, and ensure monotonicity in remote clients.
  • UUIDv7 uses a 'hex-and-dash' format but can also use Crockford’s Base32 for better readability.
  • Storing UUIDv7 in 128-bit binary format reduces storage overhead by 30–40% compared to string representations.
  • UUIDv7 identifiers can be extended beyond 128 bits with metadata and checksums.
  • UUIDv7 includes a 4-bit version field (7) and a 2-bit variant field.
  • UUIDv7 and bigint have similar search and write performance, with UUIDv7 generation rates not affecting database performance.
  • UUIDv7 eliminates issues with auto-increment keys, such as synchronization problems, key collisions, and brute-forcing risks.
  • UUIDv7 can be used in the same column as other UUID versions or ULID in binary format.