News for hackers. Stuff that matters.
Re:Unexpected downsides of UUID keys in PostgreSQL by kogus on Thursday June 22, 2023 @08:31AM (#36431140)
“5” might be the key for a thousand different records in your database. A uuid is a key for exactly one. Integer keys permit wrong joins to have the appearance of working.
Re:Unexpected downsides of UUID keys in PostgreSQL by totalhack on Thursday June 22, 2023 @08:37AM (#36431207)
You can incorrectly join on any columns you want. That's not really the fault of the column types IMO, that's a problem in the layers above.
Re:Unexpected downsides of UUID keys in PostgreSQL by dpcx on Thursday June 22, 2023 @08:46AM (#36431297)
True, but you can't incorrectly join on UUID due to its anti-collision nature.
Re:Unexpected downsides of UUID keys in PostgreSQL by ibash on Thursday June 22, 2023 @11:18AM (#36433472)
Yes you can, you’ll not get the correct result set.
Re:Unexpected downsides of UUID keys in PostgreSQL by OJFord on Thursday June 22, 2023 @02:48PM (#36436907)
As sibling says, you can make exactly the same mistake and it not colliding just means no join - but if it's an outer join and one of many joins or in a nested query it might not be immediately obvious it's happened, or what the issue is even if it is.
Re:Unexpected downsides of UUID keys in PostgreSQL by FroshKiller on Thursday June 22, 2023 @08:54AM (#36431404)
Crucially, "5" might also be the key to a thousand different records in dozens of other development & QA databases for applications with integrations configured incorrectly. Integers can match coincidentally. UUIDs won't.
Re:Unexpected downsides of UUID keys in PostgreSQL by Phil_Latio on Thursday June 22, 2023 @09:24AM (#36431793)
> Integer keys permit wrong joins to have the appearance of working.

How do you justify such an argument in the real world without people looking at you in disgust? This is the dumbest argument I've ever heard.

Re:Unexpected downsides of UUID keys in PostgreSQL by allknowingfrog on Thursday June 22, 2023 @09:54AM (#36432202)
That's not a very constructive response. UUIDs do provide global uniqueness, which can occasionally make mistakes more obvious. Do you have a counter argument to support your strong objection?
Re:Unexpected downsides of UUID keys in PostgreSQL by magicalhippo on Thursday June 22, 2023 @09:55AM (#36432220)
While wrong joins is a weak argument IMHO, our customers somewhat frequently ask to merge data, either from test to prod or from one company to another (after acquisition f.ex.).

In a lot of cases that can be a pain due to overlapping integer primary keys and large parent-child table sets.

Re:Unexpected downsides of UUID keys in PostgreSQL by antifa on Thursday June 22, 2023 @02:09PM (#36436319)
You can tell all your tables to use the same sequence.
Re:Unexpected downsides of UUID keys in PostgreSQL by smolder on Thursday June 22, 2023 @02:14PM (#36436386)
We have some app generated internal IDs which have a 1 character prefix by type and then base64 sequential stuff after that. I'll admit it's nice knowing the type of an identifier by looking at it. I don't really like that they are strings, however. The original architect made some weird choices as far as deciding where and where not to optimize for performance.