[erlang-questions] Mnesia - select with placeholder in table key
Evgeny M
donpedrothird@REDACTED
Mon May 27 00:33:02 CEST 2013
Sorry, I don't quite understand you. I'm not a native speaker, maybe I miss
something.
We select by primary key only. There are no secondary indexes in the table,
and there are no filters by other fields in the query. But the primary key
is a tuple and one of the elements of this tuple is wildcard, ie we have
records with keys {a, x, y}, {b, x, y}, {c, x, y}, {a, z, z} and want to
select all records that match {'$1', x, y}. This tuple is the key, there
aresome other fields in the record.
Will the mnesia use index in this case?
понедельник, 27 мая 2013 г., 1:17:38 UTC+4 пользователь Ulf Wiger написал:
>
> 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.
>
> BR,
> Ulf W
>
> Ulf Wiger, Feuerlabs, Inc.
> http://www.feuerlabs.com
>
> 26 maj 2013 kl. 22:46 skrev John Doe <donped...@REDACTED <javascript:>>:
>
> > 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-q...@REDACTED <javascript:>
> > http://erlang.org/mailman/listinfo/erlang-questions
> _______________________________________________
> erlang-questions mailing list
> erlang-q...@REDACTED <javascript:>
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130526/04ead23a/attachment.htm>
More information about the erlang-questions
mailing list