Re:ULID: Universally Unique Lexicographically Sortable Ident...
by ngrilly on Friday December 28, 2018 @02:37PM
(#18778889)
I did the math too after reading your comment and got the same result: on average, with 1,000,000 ULIDs per second, I'll wait 50 million years before hitting the first collision.
Here is the Python code I used: https://gist.github.com/ngrilly/565bd27f4ad63244f72578844bca...
But I'm curious to know how you computed this?
Re:ULID: Universally Unique Lexicographically Sortable Ident...
by espadrine on Friday December 28, 2018 @07:03AM
(#18776289)
I agree that collision is not an issue.
On the other hand, your consistency assumptions may be broken if you rely on the sort order for causality relationship.
You can have ULID1 < ULID2 and yet the event associated with ULID1 may be caused by the ULID2 event.
Re:ULID: Universally Unique Lexicographically Sortable Ident...
by yen223 on Friday December 28, 2018 @02:24AM
(#18775317)
Does your math rely on perfect entropy on machines you don't control?
Re:ULID: Universally Unique Lexicographically Sortable Ident...
by ngrilly on Friday December 28, 2018 @02:41PM
(#18778913)
Yes. I did the math and got the same result, relying on a perfect entropy hypothesis.
Re:ULID: Universally Unique Lexicographically Sortable Ident...
by dtech on Friday December 28, 2018 @06:17AM
(#18776152)
The point was that this was not an advantage of ULID over UUID. You need 2.7 * 10^18 v4 UUIDs for a 50% collision chance.
Re:ULID: Universally Unique Lexicographically Sortable Ident...
by InGodsName on Friday December 28, 2018 @05:49AM
(#18776070)
Did you account for long tail events?
This seems like a pointless distinction.
If I did the math right, you can generate 1,000,000 ULIDs per second (1000 per millisecond) for around 50 million years before you can expect to hit your first collision.
I don't know about you, but I'm pretty sure any system I build won't be running 50 million years from now. Not to mention that the timestamp portion of the ULID will overflow in a mere 9000 years.