[erlang-questions] Fetching several ets keys

ori brost oribrost@REDACTED
Thu Feb 9 11:59:37 CET 2012


Ahmed, The question is, will ets:select as you described be smart
enough to run lookups for each X instead of doing a fold all over the
ets and checking for every key whether it equals "A" or "B" or "C" or
"D"?

On Thu, Feb 9, 2012 at 12:49 PM, Ahmed Omar <spawn.think@REDACTED> wrote:
> ets:select(Tid, [{{'$1','$2'},[{'==','$1',X}],['$_']}|| X<-
> ["A","B","C","D"]]).
>
>
> On Thu, Feb 9, 2012 at 11:11 AM, dmitry kolesnikov <dmkolesnikov@REDACTED>
> wrote:
>>
>> You could try
>> ets:select or qlc interface.
>>
>> It table is not big enough then qlc and custom fold function would work:
>>
>> Q=qlc:q([ X || X <- ets:table(mytab)]),
>> qlc:fold(FoldFun, [], Q)
>>
>> Best Regards,
>> Dmitry >-|-|-*>
>>
>>
>> On 9.2.2012, at 11.40, ori brost <oribrost@REDACTED> wrote:
>>
>> > Is there any way in ets to fetch values for several keys in 1 call?
>> > i.e. something like
>> >
>> > ets:multi_fetch(Tid, ["A","B","C","D"]) % will fetch all entries with
>> > keys A, B, C, D
>> > _______________________________________________
>> > erlang-questions mailing list
>> > erlang-questions@REDACTED
>> > http://erlang.org/mailman/listinfo/erlang-questions
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>
>



More information about the erlang-questions mailing list