[erlang-questions] mnesia vs ets

G.S. corticalcomputer@REDACTED
Wed Oct 28 02:00:27 CET 2009


It's normal.

But you can if you wish, access the Mnesia's ets tables directly, which will
give you extra speed in reading.

Regards,
-Gene

On Tue, Oct 27, 2009 at 5:49 PM, Roberto Ostinelli <roberto@REDACTED>wrote:

> 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.
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>
>


More information about the erlang-questions mailing list