[erlang-questions] Help with storing data in memory

Adam Kelly cthulahoops@REDACTED
Tue Mar 23 11:46:52 CET 2010


On 23 March 2010 09:27, Max Lapshin <max.lapshin@REDACTED> wrote:
> Currently I have an idea to keep two ets tables: when first entry from
> first table comes to timeshift limit, I add second table and begin
> to track from which table to take frames. When first entry from second
> table comes to timeshift limit, I drop first table.
> So I eliminate ets:select_delete call

I'm guessing that you are using one of the hash map table types, in
which case lookups by time range are going to be O(N)? You've already
hit one solution, build an index and use the index to delete entries
from the main table.   You should also be able to get the performance
you need by changing your table type to ordered_set, presuming ets is
smart about that comparison operator.

Adam.


More information about the erlang-questions mailing list