Re:UUIDs are popular, but bad for performance (2019)
by rco8786 on Saturday January 08, 2022 @02:30PM
(#29855240)
Because simple integers are not universally unique, a major feature of UUIDs…
[ Parent
| on HN ]
Re:UUIDs are popular, but bad for performance (2019)
by atq2119 on Saturday January 08, 2022 @03:43PM
(#29855990)
UUIDs are integers, they just happen to be 128 bits long instead of the more common 32 or 64, and they are usually printed in a specific way that differs from how integers are usually printed. But that's just smoke and mirrors.
UUIDs are generally not guaranteed to be universally unique. The name is misleading marketing.
If you generate them randomly, then the probability of collision is small enough not to matter, but the more you introduce deterministic elements, like generating them sequentially, the more your probability of collision increases.
Re:UUIDs are popular, but bad for performance (2019)
by rco8786 on Saturday January 08, 2022 @07:16PM
(#29858232)
Yes, of course. But making them sequential does not take away from the universal(ish) uniqueness
Re:UUIDs are popular, but bad for performance (2019)
by rco8786 on Sunday January 09, 2022 @12:54PM
(#29865649)
Meant ordered here, not sequential.
Re:UUIDs are popular, but bad for performance (2019)
by inetknght on Saturday January 08, 2022 @03:27PM
(#29855822)
Is this sarcasm? If you generate an incrementing-UUID then its predictability is going to make it not-universally unique too
Re:UUIDs are popular, but bad for performance (2019)
by michaelmcmillan on Saturday January 08, 2022 @03:45PM
(#29856013)
No. Incrementing an integer might be unique for the local database, but not unique for the universe.
Re:UUIDs are popular, but bad for performance (2019)
by rco8786 on Saturday January 08, 2022 @03:27PM
(#29855831)
That is…not what universally unique means.
Re:UUIDs are popular, but bad for performance (2019)
by rwoerz on Saturday January 08, 2022 @03:46PM
(#29856026)
From RFC4122: "A UUID is an identifier that is unique across both space and time, with respect to the space of all UUIDs."
Hard to achieve if everyone starts from 00000000-0000-0000-0000-000000000000.
Re:UUIDs are popular, but bad for performance (2019)
by rco8786 on Saturday January 08, 2022 @07:18PM
(#29858252)
Right that’s why nobody starts at 0. And you don’t have to only add 1 to be ordered, no DB I’m aware of just adds 1 to sequential UUIDs. There’s always randomness/entropy involved.
Re:UUIDs are popular, but bad for performance (2019)
by ztorkelson on Saturday January 08, 2022 @05:41PM
(#29857274)
Sequential UUIDs don’t start at 0. They are a 128-bit composite of two integers; a temporal component in the high order bits and a random component in the low order bits.