Fixing UUIDv7 (for database use-cases)(brooker.co.za)
brooker.co.za
Fixing UUIDv7 (for database use-cases)
https://brooker.co.za/blog/2025/10/22/uuidv7.html
2 comments
Yeah, I don't think "fixing" is really the right term here, since this brings a different set of tradeoffs. You don't leak timestamps, you get ok page locality, but you lose the ability to sort by the IDs. I do see how this might be a good choice for a general PK default (i.e. by default, don't leak stuff).
I'd kind of be interested in an ID that does combines an autoincrement prefix with a random suffix. Every ID would be unique and monotonically increasing due to the autoincrement and the random suffix would make it unguessable (or less guessable, depending on the number of bits used). It's an odd choice for a UUID, which usually worrys about decentralized ID generation, but so many smaller apps use UUIDs with a single central postgres database...
These kinds of experiments are well suited to UUIDv8.