<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">On Fri, Nov 27, 2020 at 5:22 PM Ciprian Dorin Craciun <<a href="mailto:ciprian.craciun@gmail.com">ciprian.craciun@gmail.com</a>> wrote:</span><br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Looking at the `next/2` documentation for `ets`, it states that for<br>
`ordered_set` the function always returns the next key larger than the<br>
input, regardless if the input key exists or not.<br>
<br>
So I was wondering if this property also translates to the equivalent<br>
`next` function in `dets` and `mnesia` tables for `ordered_set` type?<br>
<br></blockquote><div><br></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">I would definitely assume that for mnesia since it is more or less reliant on ETS for the typical table configuration (i.e., anything but disc_only). I would also assume the same for dets, though here it is a bit less a given. I don't off-hand know of the dets implementation, but ETS uses an ordered tree structure (with some quite clever locks on top to avoid lock contention in the tree when multiple readers/writes interact with it). So kind-of the only way to implement next/2 is the one where you walk the tree to find the next element.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">For tables of type set, bag, ... the safe_fixtable/2 call is important in this area.</div><br></div></div>-- <br><div dir="ltr" class="gmail_signature">J.</div></div>