mnesia, large datasets and key range lookups

Ulf Wiger <>
Sat Jul 17 22:58:58 CEST 2004

On Thu, 15 Jul 2004 17:22:18 +0300, Jouni Rynö <> wrote:

> About the mnesia_frag: is there some compatibility reason, why I am
> supposed to use mnesia:activity(_, _,_, mnesia_frag) to access the DB?
> If the table does have fragmented tables, one most likely wants to use
> the fragmentation calls to access the data.

The concept of mnesia callback modules was not introduced until after a
few releases, and fragmented table support was implemented as such a
callback module (so is 'rdbms', BTW.) At the same time, the function
mnesia:activity() was introduced. Most people who use it (I think) are
mainly after the possibility to change access modes (transaction, dirty,
ets, ...), and not to use callback modules.

One advantage to having fragmentation support implemented in a callback
module is that one doesn't have to bear the overhead of looking up
fragmentation metadata when using the normal access functions This allows
mnesia to be pretty lean and mean in its default functionality, and still
be extensible for those who need that.

> And while I'm whining about my lack of understanding, the bench-program
> in the mnesia examples directory is supposed to use fragmented tables,
> but it does not use those activity calls.

It does, but perhaps not for all accesses.
If you look into bench_generate.erl, for example, you will find calls
to mnesia:activity(), sometimes in the form of an

Ulf Wiger

More information about the erlang-questions mailing list