Efficient mapping over indexed records in Mnesia
Tom McNulty
tom.mcnulty@REDACTED
Sat Jun 27 01:22:29 CEST 2009
Hi,
I have a problem very similar to the "Raise" example given in the
Mnesia manual. I would like to alter records (re-write), which hold a
specific secondary index.
So far the only ways I can achieve this are:
1) Gather candidates using index_read, and then fold over the list
applying my changes, and writing them back. The problem is that this
initial candidate result set could be massive, and I don't want to
hold it all in memory. As far as I know, there is no 'lazy' way of
walking over indexes.
2) Fold over the entire table. I haven't read the implementation, but
I assume this will solve the mem problem above, at the expense of many
times the number of disk seeks. In practice I imagine my partitions
will exceed no more than 20% of the table, making this approach quite
wasteful.
Is there anything better I can do with Mnesia?
Thanks,
- Tom
More information about the erlang-questions
mailing list