[erlang-questions] ets select match specification analysis

Ulf Wiger <>
Sat Jul 25 22:03:42 CEST 2009


Paul Mineiro wrote:
> 
> currently tcerl will also recognize a partially bound prefix key and
> restrict the range of keys considered.  however for an application i'm
> working on i need efficient queries corresponding to match specifications
> that look like
> 
> [ { { { '$1', '_' }, '_' },
>     [ { '>', '$1', Lower }, { '<', '$1', Upper } ],
>     [ '$_' ]
>   }
> ]
> 
> which ideally would only consider the range of keys defined by tuples
> whose first element is between Lower and Upper.

Ideally, yes, but the way select() is implemented, it will still
result in a full scan of the table, unless I've missed some
key release note somewhere. I'd love to be proven wrong.

BR,
Ulf W
-- 
Ulf Wiger
CTO, Erlang Training & Consulting Ltd
http://www.erlang-consulting.com


More information about the erlang-questions mailing list