<story><title>ULID: Universally Unique Lexicographically Sortable Identifier</title><url>https://github.com/ulid/spec</url></story><parent_chain><item><author>bearmcbearsly</author><text>&amp;gt; No you cannot, unless you&amp;#x27;re running a single threaded server process on a single machine. What you can do is _gamble_ that you probably won&amp;#x27;t have a collision&lt;p&gt;This seems like a pointless distinction.&lt;p&gt;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.&lt;p&gt;I don&amp;#x27;t know about you, but I&amp;#x27;m pretty sure any system I build won&amp;#x27;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.</text></item><item><author>munk-a</author><text>&amp;gt; First, the main benefit of ULID is that you can generate the IDs within your own software rather than rely on the database. We can queue them or even reference them before they land in the database. The traditional roundtrip has been eliminated.&lt;p&gt;No you cannot, unless you&amp;#x27;re running a single threaded server process on a single machine.  What you can do is _gamble_ that you probably won&amp;#x27;t have a collision, which is the same thing you could do with regular UUIDs and you&amp;#x27;d be (nearly) guaranteed to never hit a conflict with UUID4 (or probably UUID1&amp;#x2F;2 if you trusted your mac address uniqueness).&lt;p&gt;You may find this gamble acceptable and many people do, but you should be aware that pre-generation of UUIDs on independent systems without coordination is not a solvable problem - all attempts to do so rely on the extreme unlikelihood of a collusion to feel good about it or use some coordinated information (like a guaranteed unique mac address).&lt;p&gt;(Again, if it&amp;#x27;s good enough for you, right on - but it isn&amp;#x27;t theoretically safe)</text></item><item><author>brdd</author><text>We have used ULIDs in production for over a year now-- and have generated millions of these.&lt;p&gt;First, the main benefit of ULID is that you can generate the IDs within your own software rather than rely on the database. We can queue them or even reference them before they land in the database. The traditional roundtrip has been eliminated.&lt;p&gt;Secondly, being able to sort ULIDs is a nice plus, although not that big of a deal. It makes it relatively easy to shard or partition databases, and it provides a convenient sort if you&amp;#x27;re not looking for extreme accuracy.&lt;p&gt;ULIDs are also shorter and slightly more user friendly than UUIDs.&lt;p&gt;In some circumstances we found the actual implementations to be slightly lacking. For example, the JS library for ULID once returned a 25 character string rather than the standard 26 characters, causing a big ruckus that we had to manually resolve.</text></item></parent_chain><comment><author>ngrilly</author><text>I did the math too after reading your comment and got the same result: on average, with 1,000,000 ULIDs per second, I&amp;#x27;ll wait 50 million years before hitting the first collision.&lt;p&gt;Here is the Python code I used:
&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;gist.github.com&amp;#x2F;ngrilly&amp;#x2F;565bd27f4ad63244f72578844bca5f17&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;gist.github.com&amp;#x2F;ngrilly&amp;#x2F;565bd27f4ad63244f72578844bca...&lt;/a&gt;&lt;p&gt;But I&amp;#x27;m curious to know how you computed this?</text></comment>
<story><title>ULID: Universally Unique Lexicographically Sortable Identifier</title><url>https://github.com/ulid/spec</url></story><parent_chain><item><author>bearmcbearsly</author><text>&amp;gt; No you cannot, unless you&amp;#x27;re running a single threaded server process on a single machine. What you can do is _gamble_ that you probably won&amp;#x27;t have a collision&lt;p&gt;This seems like a pointless distinction.&lt;p&gt;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.&lt;p&gt;I don&amp;#x27;t know about you, but I&amp;#x27;m pretty sure any system I build won&amp;#x27;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.</text></item><item><author>munk-a</author><text>&amp;gt; First, the main benefit of ULID is that you can generate the IDs within your own software rather than rely on the database. We can queue them or even reference them before they land in the database. The traditional roundtrip has been eliminated.&lt;p&gt;No you cannot, unless you&amp;#x27;re running a single threaded server process on a single machine.  What you can do is _gamble_ that you probably won&amp;#x27;t have a collision, which is the same thing you could do with regular UUIDs and you&amp;#x27;d be (nearly) guaranteed to never hit a conflict with UUID4 (or probably UUID1&amp;#x2F;2 if you trusted your mac address uniqueness).&lt;p&gt;You may find this gamble acceptable and many people do, but you should be aware that pre-generation of UUIDs on independent systems without coordination is not a solvable problem - all attempts to do so rely on the extreme unlikelihood of a collusion to feel good about it or use some coordinated information (like a guaranteed unique mac address).&lt;p&gt;(Again, if it&amp;#x27;s good enough for you, right on - but it isn&amp;#x27;t theoretically safe)</text></item><item><author>brdd</author><text>We have used ULIDs in production for over a year now-- and have generated millions of these.&lt;p&gt;First, the main benefit of ULID is that you can generate the IDs within your own software rather than rely on the database. We can queue them or even reference them before they land in the database. The traditional roundtrip has been eliminated.&lt;p&gt;Secondly, being able to sort ULIDs is a nice plus, although not that big of a deal. It makes it relatively easy to shard or partition databases, and it provides a convenient sort if you&amp;#x27;re not looking for extreme accuracy.&lt;p&gt;ULIDs are also shorter and slightly more user friendly than UUIDs.&lt;p&gt;In some circumstances we found the actual implementations to be slightly lacking. For example, the JS library for ULID once returned a 25 character string rather than the standard 26 characters, causing a big ruckus that we had to manually resolve.</text></item></parent_chain><comment><author>yen223</author><text>Does your math rely on perfect entropy on machines you don&amp;#x27;t control?</text></comment>