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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="mischief901" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  mischief901
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body">
								<p>Not sure if I’m going to be any help, but I did something similar recently. I didn’t have to match based on a specific item in a list but by the length. The match specifications used by :ets.select and others can get confusing so I just used the fun2ms in iex to create that.</p>
<p>Now on to your problem. I used :ets.first and :ets.next to iterate thru the table and get every set of value stores. It was an unordered set but it still reaches all the nodes when not operated on concurrently. It does take a few seconds for roughly 170k entries. After which point I just used a case statement and guards on every entry to find what I needed within the lists stored at each table entry. I just did this earlier today so it could probably be optimized further but the amount of time it takes isn’t too long for what I’m doing. If you need something in a few milliseconds, I’d go with a different approach.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="27105" 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/matching-a-value-in-an-ets-stored-list/4126/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-27105" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="27105"
                     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="27138" data-post-id="27138">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="melmoth" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/melmoth/120/4568_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  melmoth
                      <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">
								<aside class="quote no-group quote-modified" data-username="peerreynders" data-post="11" data-topic="4126" data-full="true">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/peerreynders/48/5826_2.png" class="avatar"> peerreynders:</div>
<blockquote>
<p>Yes, but please look at your original post.</p>
<aside class="quote no-group" data-username="melmoth" data-post="1" data-topic="4126">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/melmoth/48/4568_2.png" class="avatar"> melmoth:</div>
<blockquote>
<p>So considering a stored tuple containing a list, what is the golden path to match a tuple whose list contains a given value ?</p>
</blockquote>
</aside>
<p>and now where we have arrived at. You already had a solution in mind and asked for help with that solution - while at the same time not revealing what your problem at large actually was. Topic contributors can only effectively help you if you clearly outline the <em>actual</em> problem and constraints that you are working under - otherwise we all possibly end up in an <a href="http://mywiki.wooledge.org/XyProblem" rel="noopener nofollow ugc"><em>X-Y Problem</em></a> kind of situation.</p>
<p>The point is that there are probably forum members around who can give you some tips on how to establish a benchmark that gives a fair and realistic assessment of the technologies capabilities to address your particular requirements but they wouldn’t have been necessarily drawn in by your topic title or original post.</p>
</blockquote>
</aside>
<p>Hi <a class="mention" href="/u/peerreynders" rel="nofollow">@peerreynders</a></p>
<p>I understand your remark, but actually my initial question is definitely part of the problem. If i want to extend the elixir school example, I’m an intermediary recruiter, as so I have a amount of developer profiles  with some attributes describing their abilities (eg known languages, country, city etc). When i receive a job offer, my job is to match a set of dev on this offer.</p>
<p>Even if it s a multicirteria match, the main question I had (as a newbie I repeat i m not by any mean a functional programer yet :), wanting to test something more evolved that a regular list of map/struct, was how to filter on this list stored in a map in ETS. I deliberately reduced the scope because adding “andalso” clause didn’t seem too complicated.</p>
<p>So considering only this scope, everyone answered fully my question (and more actually I understood the complexity limitation chosen on guard clause, had some alternative proposal, some real world experiment). For now, being still in the learning slope, I just try to address the functional problem (multicriteria match) before trying to optimize anything. My remark on benchmark is just a rule of thumb concerning optimization investigation, I m not at this stage now so this post won’t flow on this side of the topic <img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji" alt=":wink:" loading="lazy" width="20" height="20"></p>
<p>Thanks again</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="27138" 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/matching-a-value-in-an-ets-stored-list/4126/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-27138" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="27138"
                     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="27139" data-post-id="27139">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="melmoth" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/melmoth/120/4568_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  melmoth
                      <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">
								<p>Hey <a class="mention" href="/u/mischief901" rel="nofollow">@mischief901</a>, thanks to contribute <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<p>In term of volume, I will deal with less (10x - 15 less actually) so i will definitely give a try to the foldl solution given by <a class="mention" href="/u/peerreynders" rel="nofollow">@peerreynders</a> (which should have the same complexity as yours). Even if it does not fit, i will learn from this option.</p>
<p>Thanks again for your feedback !!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="27139" 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/matching-a-value-in-an-ets-stored-list/4126/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-27139" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="27139"
                     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>