[erlang-questions] mnesia secondary index
Wed Jun 23 10:44:22 CEST 2010
On 23 June 2010 00:18, Evans, Matthew <> wrote:
> I have a fragmented mnesia table that I need to add a second index to.
> It appears that to get this working I need to call mnesia:add_table_index/2
> for each fragment.
Yes - that is correct.
> Likewise, to do an index read of the fragmented table I need to search each
> fragment in turn:
Not really - the following code should do.
dirty_index_read(Tab, SecondaryKey, Pos) ->
F = fun(T, Sk, P) -> mnesia:index_read(T,Sk,P) end,
mnesia:activity(async_dirty, F, [Tab, SecondaryKey, Pos], mnesia_frag).
More information about the erlang-questions