[erlang-questions] Mnesia - select with placeholder in table key

Ulf Wiger ulf@REDACTED
Sun May 26 23:17:38 CEST 2013

If the key position is unbound, mnesia will check if any indexed position is bound, and if so, use the first such value for an index lookup. It then uses match_spec_run() on the result.

Ulf W

Ulf Wiger, Feuerlabs, Inc.

26 maj 2013 kl. 22:46 skrev John Doe <donpedrothird@REDACTED>:

> If I use select when the key is tuple with placeholders, something like this (taken from erlang docs and changed a bit):
> MatchHead = #person{name = {'$1', "K", "Jameson"}, sex = '$2', _ = '_'},
> Result = '$2',
> mnesia:select(Tab,[{MatchHead, [], [Result]}])
>  where name is the table key
> will mnesia do full table scan in this case? Or it will be smarter and select all records with key matching {_, "K", "Jameson"} using index somehow? 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

More information about the erlang-questions mailing list