News for hackers. Stuff that matters.
Re:Features I'd Like in PostgreSQL by danielheath on Sunday January 29, 2023 @12:46AM (#34565297)
> Encourages uuids generated client-side.

Is there an actual problem with this? I don't mean "it feels impure" - what's the failure case here that's severe enough to discard UUIDs as PKs?

The other reasons all boil down to 'database performance tuning', which is reasonable if you have any prospect of needing it, but most datasets are _tiny_.

Re:Features I'd Like in PostgreSQL by srcreigh on Sunday January 29, 2023 @03:36PM (#34572441)
The other reasons are more important imo, and they aren’t really all tuning more ergonomics and simplicity.

There’s a lot more edge cases when you use client-side generated IDs. You have to check if the ID is actually new to avoid security issues is the main one. If you do offline first ID generation using global uuids, the possibility of conflicts (due to bugs, patched client code, etc) that’s a whole rabbit hole of edge cases and problems as well.

It can be done, Bret Taylor used that architecture for quip, but it’s needlessly tricky which is the whole story for UUIDs imo - annoying and slightly worse for many normal apps. If you’re building a complex distributed system and want to deal with all the trickiness, go ahead. I’d recommend you use a B64 custom identifier instead of UUID so that it’s copy paste able :-)

Re:Features I'd Like in PostgreSQL by stickfigure on Monday January 30, 2023 @01:31AM (#34576502)
>> Encourages uuids generated client-side.

>Is there an actual problem with this?

The nature of your application and its security and idempotence needs will determine who should (ideally) generate ids for any specific context. The format is irrelevant.

Generate ids on the client when it makes sense, generate them on the server when it makes sense. Server-side is more common but if you choose poorly you'll make bad software either way.