This document presents new time-based UUID formats which are suited for use as a database key.
A common case for modern applications is to create a unique identifier for use as a primary key in a database table.
This identifier usually implements an embedded timestamp that is sortable using the monotonic creation time in the most significant bits.
In addition the identifier is highly collision resistant, difficult to guess, and provides minimal security attack surfaces.
None of the existing UUID versions, including UUIDv1, fulfill each of these requirements in the most efficient possible way.
This document is a proposal to update with three new UUID versions that address these concerns, each with different trade-offs.
My understanding is that as long as IDs are roughly the same range of the index instead of literally random, it reduces the thrashing about needed for indexing these. It probably doesn’t need to be perfectly exact. They’re talking about B-trees, so these would all be modifying the same smaller branches of the tree instead of going in all over the place.
Yeah, that is my understanding, too. Otherwise you’d only want to generate them on the database host, as even with NTP there will be small differences. This would kind of defeat the purpose of UUIDs.
If you’re saying that even without NTP, just by manually setting the time, things will be fine. I mean, maybe. But I’ve seen it far too many times already that some host shows up with 1970-01-01…
Haha, that’s fair, someone absolutely would manage to write 1970s dates if they aren’t pulling the current time.