<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="254101" data-post-id="254101">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="fireproofsocks" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/fireproofsocks/120/7669_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  fireproofsocks
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>haha, I see where I made my mistake.  I imagined that I could break up a binary number 128 bits in length into 2 pieces of 64 bits each.  But then I made the mistake of thinking I could represent each piece with a 64 bit character instead a character (or characters) that can represent 2^64 (whoops… very wrong).  64 = 2^7, so I would need at least 19 characters to represent 128 bits (because 128 / 7 = 18.29).</p>
<p>Thank you for checking me on this, and I appreciate the links to the alternate packages!  Good to know there are so many options.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="254101" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/uuid-vs-nanoid-ways-to-express-ids-compactly/48501/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-254101" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="254101"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="254109" data-post-id="254109">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sbuttgereit" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sbuttgereit/120/30162_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sbuttgereit
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Yep.  This is the RFC I’d like to see get adopted (an aside, your link to the RFC 404’s for me, I find it at: <a href="https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-03.html" class="inline-onebox" rel="noopener nofollow ugc">New UUID Formats</a>).  I’ve been watching it for a fair while now and my biggest concern is that it feels like it is moving through the standards process on geologic time scales (this is probably because of my ignorance of the standards process and my own impatience generally).  Otherwise, it seems to have the right trade-offs, and speaks directly to more recent trends in using UUIDs with relational databases.</p>
<p>I have heard that ULID suffers some from it’s monotonic option definition, though this article seems to dispute that (<a href="https://zendesk.engineering/how-probable-are-collisions-with-ulids-monotonic-option-d604d3ed2de" rel="noopener nofollow ugc">https://zendesk.engineering/how-probable-are-collisions-with-ulids-monotonic-option-d604d3ed2de</a>)… I certainly wouldn’t expect it to be an issue for the workloads I’m dealing with.  Working with PostgreSQL, the libraries I’ve seen for ULID don’t really implement handling the monotonic option at all (it’s been quite awhile since I’ve looked though.)</p>
<p>I think if I were to do anything it would be UUIDv6/7/8 as if it lands as a standard, I’d expect it to have better options for official support in the database.</p>
<p>[EDIT]  I forgot to mention that for those in PostgreSQL-land… this is also an option:<br>
<a href="https://github.com/tvondra/sequential-uuids" class="onebox" target="_blank" rel="noopener nofollow ugc">https://github.com/tvondra/sequential-uuids</a><br>
discussed at: <a href="https://www.2ndquadrant.com/en/blog/sequential-uuid-generators/" class="inline-onebox" rel="noopener nofollow ugc">EDB Home - EDB Postgres AI: Petabyte-Scale Data Management</a><br>
and <a href="https://www.2ndquadrant.com/en/blog/sequential-uuid-generators-ssd/" class="inline-onebox" rel="noopener nofollow ugc">EDB Home - EDB Postgres AI: Petabyte-Scale Data Management</a></p>
<p>I’ve entertained using it, but haven’t gone too far.  I like that it’s a C extension and that 2ndQuadrant are somewhat behind it.  I’m not overly eager to depend on 3rd party extension without a strongly compelling use case which I haven’t got now: the built in stuff is sufficient.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="254109" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/uuid-vs-nanoid-ways-to-express-ids-compactly/48501/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-254109" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="254109"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="254110" data-post-id="254110">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="kip" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kip/120/1440_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  kip
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>ex_cldr Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/sbuttgereit" rel="nofollow">@sbuttgereit</a> thanks for the heads up on the broken link. Fixed in the original post. Seems like it may have moved recently.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="254110" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/uuid-vs-nanoid-ways-to-express-ids-compactly/48501/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-254110" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="254110"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="254111" data-post-id="254111">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sbuttgereit" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sbuttgereit/120/30162_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sbuttgereit
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Looks like it’s been updated: <a href="https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-uuid-format/" class="inline-onebox" rel="noopener nofollow ugc">draft-peabody-dispatch-new-uuid-format-04 - New UUID Formats</a></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="254111" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/uuid-vs-nanoid-ways-to-express-ids-compactly/48501/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-254111" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="254111"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="254203" data-post-id="254203">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="adamu" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/adamu/120/31482_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  adamu
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="fireproofsocks" data-post="1" data-topic="48501">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/fireproofsocks/48/7669_2.png" class="avatar"> fireproofsocks:</div>
<blockquote>
<p>So the question is: couldn’t we just offer a different VIEW on top of the existing UUIDv4? In other words, couldn’t we just represent those 128 bits differently to save screen real-estate? For example, if we choose an alphabet of a-z and digits 0 - 5, we would have 32 characters at our disposal</p>
</blockquote>
</aside>
<p>You are basically describing <a href="https://hexdocs.pm/elixir/Base.html#module-base-32-alphabet" rel="noopener nofollow ugc">Base 32</a>:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">iex(1)&gt; Mix.install [:ecto]; alias Ecto.UUID
Ecto.UUID
iex(2)&gt; uuid_traditional = UUID.generate
"3290925b-0956-48a4-9690-cb027c333a96"
iex(3)&gt; uuid_binary = UUID.dump!(uuid_traditional)
&lt;&lt;50, 144, 146, 91, 9, 86, 72, 164, 150, 144, 203, 2, 124, 51, 58, 150&gt;&gt;
iex(4)&gt; uuid_base_32 = Base.encode32(uuid_binary, padding: false, case: :lower)
"gkijewyjkzekjfuqzmbhymz2sy"
iex(5)&gt; [traditional_string: String.length(uuid_traditional), base_32: String.length(uuid_base_32)]
[traditional_string: 36, base_32: 26]
</code></pre>
<p>So using Base 32 instead of Base 16 with hyphens saves you 10 characters.</p>
<p>You can save another 4 characters by using Base64, at the cost of being less copy/pastable because of <code>+</code> and <code>/</code> (or <code>-</code> for the URL-safe version):</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">iex(6)&gt; uuid_base_64 = Base.encode64(uuid_binary, padding: false)
"MpCSWwlWSKSWkMsCfDM6lg"
iex(7)&gt; String.length(uuid_base_64)
22
</code></pre>
<p>Note that lengths <code>26</code> and <code>22</code> are guaranteed, because:</p>
<p>Base 32: 1 character represents 32, or 2^5 values = 5 bits. 128-bit UUID requires <code>round(128/5)</code> = 26 characters.<br>
Base 64: 1 character represents 64, or 2^6 values = 6 bits. 128-bit UUID requires <code>round(128/6)</code> = 22 characters.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="254203" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/uuid-vs-nanoid-ways-to-express-ids-compactly/48501/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-254203" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="254203"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="381298" data-post-id="381298">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="dingosky" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dingosky/120/6453_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  dingosky
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Quite late on this response, but I would clarify a potential misunderstanding: <strong>UUID</strong>s are neither <em>Unique</em> nor are they <em>Universal</em>. The “need distributed generation of unique IDs” and “morph into …” comments mask this fact: UUIDs <em><strong>are</strong></em> a fixed entropy and fixed representation of a <strong>PUID</strong>, or <strong>HUID</strong>, or <strong>MUID</strong>, or <strong>LPTUID</strong>, or whatever you want to call it. The name is a misnomer: <strong>UUID</strong>s are a subset of <strong>PUID</strong>s, regardless of the name.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="381298" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/uuid-vs-nanoid-ways-to-express-ids-compactly/48501/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-381298" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="381298"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>