News for hackers. Stuff that matters.
Re:Unexpected downsides of UUID keys in PostgreSQL by whack on Thursday June 22, 2023 @08:44AM (#36431279)
> The moral of the story is that data locality matters, and it can pop up in the most surprising of places. Using random is typically the worst thing you can do for locality, so if you want to use UUID’s, try to use a sequential variant. UUID v7 is a good option

The author isn't suggesting abandoning UUIDs, he is suggesting using something like UUIDv7 which preserves locality. For most use-cases, this seems like a very reasonable recommendation with no significant downsides I can think of.

Re:Unexpected downsides of UUID keys in PostgreSQL by fauigerzigerk on Thursday June 22, 2023 @09:21AM (#36431748)
I agree that UUIDv7 will usually be the best choice. The one downside I can think of is that it may sometimes be necessary to let people know the identity of a thing without also telling them exactly when that thing was created.
Re:Unexpected downsides of UUID keys in PostgreSQL by pkilgore on Thursday June 22, 2023 @09:56AM (#36432241)
COMB UUIDs can help here.
Re:Unexpected downsides of UUID keys in PostgreSQL by fauigerzigerk on Thursday June 22, 2023 @12:37PM (#36434786)
Why do COMB UUIDs not have this problem? Do they not contain a timestamp?
Re:Unexpected downsides of UUID keys in PostgreSQL by pkilgore on Friday June 23, 2023 @05:38PM (#36452489)
It just orders ids based on a monotonic clock that wraps after a certain time -- it's enough to get a lot of of the performance benefit of ordered keys without directly exposing the unix wall clock time they were created (absent a dedicated attacker with the ability to create ids without you picking up on it for a timing attack, I suppose).

Whether that tradeoff makes sense probably depends.

Re:Unexpected downsides of UUID keys in PostgreSQL by remram on Thursday June 22, 2023 @10:47AM (#36432960)
Encrypt it. Block ciphers are bijective so they will turn sequential IDs into unique random IDs in a way you can easily reverse.

You can also do that to get opaque identifiers from an auto-increment primary key.

Re:Unexpected downsides of UUID keys in PostgreSQL by fauigerzigerk on Thursday June 22, 2023 @12:04PM (#36434283)
Seems awfully complicated to me.