[erlang-questions] Mnesia list of keys query

nato nbartley@REDACTED
Fri Aug 26 21:25:28 CEST 2016


Hi List -- long time lurker, first-time poster...

I can't seem to find a satisfactory answer to getting all the records
from an Mnesia table, given a list of keys to match on. Much
preferably, I wanted to stay clear of a match-spec solution, in favor
of qlc (if even needed).

There wasn't anything I found in the manual on a couple of passes
going through it and my first-pass attempt just *seems* like it would
be dog slow:

L = ManyKeys.
Fn = fun() ->
      do(qlc:q([ X || X <- mnesia:table(foo),
        lists:member(X#foo.bar_id, L) ]))
    end.
{atomic, L2} = mnesia:transaction(Fn).



More information about the erlang-questions mailing list