UUIDv7: The Time-Sortable Identifier for Modern Databases

The world of unique identifiers is vast, and UUIDs (Universally Unique Identifiers) have long held a prominent position due to their ability to uniquely identify information across distributed systems. Among the UUID versions, UUIDv7 (IETF RFC4122 link) has recently garnered attention. This simple webpage (including the UUID7 Generator and UUIDv7 validator!) is designed to explore the benefits, especially its significance in database systems.

Generate a UUIDv7:

Check the box above and watch how the 2nd set of characters update incrementally!

Validate a UUIDv7:


What is UUIDv7?

UUIDv7 is one of the UUID versions that is time-based, much like UUIDv1. However, it offers a precise timestamp, up to 50 nanosecond resolution. The core feature that sets UUIDv7 apart is its time-sortable property. This means that newer UUIDs generated will be greater in value than older ones, and thus, they can be naturally sorted based on creation time. This is especially useful for database indexes.

Benefits of UUIDv7:

Why UUIDv7 is Better for Databases:

Conclusion:

While UUIDv7 is not a one-size-fits-all solution, it offers specific advantages for databases, especially when time-based sorting and high precision are required. As modern applications become more distributed and demand faster real-time operations, UUIDv7 presents a compelling choice for unique identification.

Remember, the choice of identifier should always depend on the specific needs and constraints of your system. But with its array of benefits, UUIDv7 is undeniably a strong contender for many modern database use-cases.

Updates:

As of the latest draft, UUIDv7 has a default time resolution of 1 millisecond. The original https://uuid7.com code utilized code that was based on a previous draft, which went to 50 (or 100) nanosecond precision. Updated 2024-03-20 to use the fixed 1 millisecond precision code.

Disclaimer:

This is a demo site for UUIDv7. It was generated almost entirely with AI tools (primarily ChatGPT, which hallicunated that UUIDv7 had a time resolution of 10 nanoseconds and I cleaned that up). Do not use this UUIDv7 generator for production purposes.

Deployment Details

This site is deployed via docker-compose on a self-hosted VM running self-hosted GitHub Runner. The stack is Flask/NGINX/Cloudflared (which tunnels out to the internet). For a detailed post, see https://austinsnerdythings.com/2023/11/01/using-github-actions-to-deploy-a-flask-nginx-cloudflared-tunnel-docker-compose-stack/