4 ms·
> Use client-generated unique keys. We use GUIDs. Minor note but wouldn't UUIDs be better since they're time based? Sure it's really unlikely to hit an already
by BinaryIdiot 10y ago
> Use client-generated unique keys. We use GUIDs.
Minor note but wouldn't UUIDs be better since they're time based? Sure it's really unlikely to hit an already used GUID but an UUID makes it impossible.
In fact is there a use case where it's better to use GUIDs over UUIDs? I couldn't think of one but I could be omitting something from my thinking so I'm curious.
Edit: apparently GUID and UUID are the same thing and GUID is simply Microsoft's original implementation of UUID. All this time I had no idea...
- tqwhite 10y agoThey are the same thing. Both should include time as well as the server address, etc.
- BinaryIdiot 10y agoAh you're right. GUID is Microsoft's implementation of UUID. I guess, much like how many refer to tissues nowadays as Kleenex, the terms kinda got mixed around. At least in my experience from seeing how they're used.
- huehehue 10y agoCalled a "proprietary eponym", for those curious. https://en.wiktionary.org/wiki/proprietary_eponym https://en.wiktionary.org/wiki/proprietary_eponym
- Vendan 10y agonote there are like 5 versions of UUID, and only v1 and v2 include time and server address. It's also considered bad practice to use them, as it makes your UUID's guessable.
- treve 10y agoDepends entirely on what you're using them for.
- rco8786 10y agoGUID == UUID
- rspeer 10y agoUUIDs of all formats are universally unique, for all practical purposes. Consider UUID4, the one with 122 random bits. The birthday paradox says that you would need about 2^61 UUIDs before you expect even one duplicate. If this concerns you, you might not recognize how big 2^61 is. (edited because I was originally talking about 2^64, but there are 6 non-random bits in UUID4)
- dbenhur 10y agoWhat does "expect even one" mean? This is a probability equations, so what p does expect correspond to? Let's make this real concrete, with 122 random bits, you can issue a million UUIDv4s every second for the next 100 years and still have a less than one in a million chance that you issued a duplicate. https://lazycackle.com/Probability_of_repeated_event_online_calculator__birthday_problem_.html https://lazycackle.com/Probability_of_repeated_event_online_... n = 5316911983139663491615228241121378304 (2122) p = 0.000001 => m = 3260955271619137 3260955271619137/(100000086400365) => 103