mnesia vs ets

Roberto Ostinelli <>
Wed Oct 28 01:49:44 CET 2009


dear all,

i am populating a mnesia disc_copies table with 20,000 records like this:

WriteFun = fun() -> [mnesia:dirty_write({test_table, K, {}}) || K <-
lists:seq(1, 20000)] end,
mnesia:activity(sync_dirty, WriteFun).

then i try reading from the table using mnesia:

[mnesia:dirty_read(test_table, K) || K <- lists:seq(1, 20000)].

and then using ets:

[ets:lookup(test_table, K) || K <- lists:seq(1, 20000)].

benchmarking the two ways of reading gives the following results:

MNESIA: 29473.89 rows / min.
ETS: 93312.60 rows / min.

this means that with ets reading speed is 3x than dirty_read with MNESIA.

am i missing something here, or is this normal?

r.


More information about the erlang-questions mailing list