4 ms·
Yeah I don't really get the point of this article, if you need random values of a specific size don't use uuid, it's literally specified to be one exact length
by corytheboyd 4y ago
Yeah I don't really get the point of this article, if you need random values of a specific size don't use uuid, it's literally specified to be one exact length and format.
- ejb999 4y ago>>Yeah I don't really get the point of this article, To get clicks?
- corytheboyd 4y agoYou're not wrong lol
- sieabahlpark 4y ago
- tejtm 4y agoone exact length and five "versions" of the format (so far) https://en.wikipedia.org/wiki/Universally_unique_identifier#Versions https://en.wikipedia.org/wiki/Universally_unique_identifier#...
- adileo 4y agoI made a comparison list with the most known uuids out there, a couple of days ago, it was quite fun discovering all the different kinds of uid and their pros/cons. https://adileo.github.io/awesome-identifiers/ https://adileo.github.io/awesome-identifiers/
- djbusby 4y agoULID example should be in uppercase. Love this chart tho.
- JimDabell 4y agoKSUIDs are fairly popular and missing from your list: https://github.com/segmentio/ksuid https://github.com/segmentio/ksuid
- 8n4vidtmkvmk 4y agowhat's the resolution on those? 32 bits, 100 years.. that seconds right? doesn't sound excellent for time ordering. 100 years also seems a little short but at least I'll be dead
- sekh60 4y agoDon't look at it as being your problem in 100 years, but as helping employment in 100 years and helping the economy ;)
- bmn__ 4y agohttps://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format#page-4 https://datatracker.ietf.org/doc/html/draft-peabody-dispatch...
- BerislavLopac 4y agoIt is also highly recommended that you include a check digit into it, to minimize the chance of a collision. I've used https://arthurdejong.org/python-stdnum https://arthurdejong.org/python-stdnum for that purpose.
- sokoloff 4y agoI don't see how a check digit minimizes the chance of collision. (Here, I'm assuming that a check digit is calculated from the other digits. What am I thinking about incorrectly?)
- georgemcbay 4y agoLooking at the docs for the library linked, it appears to be a Verhoeff algorithm check digit... so yeah, you're correct. This is effectively a simplistic stand-in for a CRC type system -- useful to detect if the data has been corrupted, but not useful to avoid collisions.
- TedDoesntTalk 4y agoAnd if someone is worried about UUID collisions, they need to rethink their priorities in life.
- BerislavLopac 4y agoYou are correct, this should teach me not to write comments when I'm too tired. :/ The check digit wouldn't really help with collisions, since if the strings are the same the digit will be too. They are primarily useful when we need to ensure correctness on human input.
- throwawaymaths 4y agoAlso most well-designed systems only use the UUID as the representation format and use raw bits in performance-critical parts.
- lolinder 4y agoThe raw bits are the UUID, the hex string is just a human-readable representation that also plays nicely with JSON.
- throwawaymaths 4y agoTell that to Django (well 5 years ago anyways iirc, don't know what it does now). Pretty sure it used to store uuids as strings columns in your sql.
- lolinder 4y agoYep, looks like it does the right thing in PostgreSQL but not anywhere else [0]. https://docs.djangoproject.com/en/4.1/ref/models/fields/#uuidfield https://docs.djangoproject.com/en/4.1/ref/models/fields/#uui...
- throwawaymaths 4y agoI feel like it did strings in postgres too, not too long ago and I had a <brain explode> moment when I worked on a codebase and had to figure out why queries were terrible
- lolinder 4y agoSupposedly the behavior hasn't changed since at least version 1.8: https://docs.djangoproject.com/en/1.8/ref/models/fields/#uuidfield https://docs.djangoproject.com/en/1.8/ref/models/fields/#uui... It may not have worked correctly on your project for some reason?
- 4y ago
- _3u10 4y agoUse uint128_t instead.
- scott_w 4y agoThe number of comments saying "using UUIDs for secrets isn't that bad" suggests this article needs to be written...