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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<blockquote>
<p>b) ID-s weren’t integers but GUID-s?</p>
</blockquote>
<p>You can try <code>uuid_hash</code> if you’ve got UUIDs on Postgres:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">select mod(mod(uuid_hash(gen_random_uuid()), 10) + 10, 10);
</code></pre>
<p>Note the awkward <code>mod(mod(thing, x) + x, x)</code> form that took. That’s because Postgres’s native <code>mod</code> functionality, annoyingly, can return negative values: <a href="https://stackoverflow.com/a/32402428/5932228" rel="noopener nofollow ugc">https://stackoverflow.com/a/32402428/5932228</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="267527" 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/how-to-split-data-into-equal-parts-properly-to-process-them-evenly/51590/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-267527" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="267527"
                     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="267531" data-post-id="267531">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="benwilson512" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/benwilson512/120/1457_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  benwilson512
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Author of Craft GraphQL APIs in Elixir with Absinthe</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="tirana" data-post="11" data-topic="51590">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/t/e19b73/48.png" class="avatar"> tirana:</div>
<blockquote>
<p>ID-s were not more or less sequential?</p>
</blockquote>
</aside>
<p>If you’re using auto incrementing keys then it is more or less sequential. If you’re splitting into N partitions, you would need a delete pattern that favored one specific value of N more than others. As I said in the earlier post it’s trivial to just go query your database to see if that is happening in your case: <code>select id % 10, count(id) from table group by 1</code>.</p>
<p><a class="mention" href="/u/billylanchantin" rel="nofollow">@billylanchantin</a> is dead on with the uuid answer. Basically what we’re using <code>%</code> here for is a kind of “consistent hash” which reliably turns a given input value into one of a smaller set of output values. <code>%</code> is a very efficient way of doing this for integers, but there are other consistent hashing functions that work on other values too.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="267531" 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/how-to-split-data-into-equal-parts-properly-to-process-them-evenly/51590/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-267531" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="267531"
                     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>