3 ms·
I took a shot at the math behind this at https://www.codepasta.com/databases/2020/09/10/shorter-unique-ids.html https://www.codepasta.com/databases/2020/09/10/s
by munawwar 4y ago
I took a shot at the math behind this at https://www.codepasta.com/databases/2020/09/10/shorter-unique-ids.html https://www.codepasta.com/databases/2020/09/10/shorter-uniqu...
Using the equation listed in the article I couldn't generate a collision so far. Yet, I still check (in code) for id collision, and pick new id, just to be 100% sure.
- Olreich 4y agoThis article mostly just says: "If your data is small, then 56 bits is fine". Which is true. But if you are at 56 bits in your UUID, then just use an integer PK with 64 bits and you'll be fine a good deal longer. If your data might get large, an extra 64 bits to get a full 128bit UUID isn't expensive, and encoding in Base36 still yields 25 character UUIDs, which are pretty manageable: "abcdef-01234-56789-ghi-jklmno" (6-5-5-3-6, or max of a u16 for digits). I'm honestly shocked no UUID library makes it easy to export in Base36 with that grouping, it's very neat and tidy and easy to remember.
- Dylan16807 4y agoWhy base36 in particular? That implies that you're worried you might lose case information but you're not worried about characters that look the same?