[erlang-questions] mnesia vs ets

Ulf Wiger <>
Wed Oct 28 08:58:00 CET 2009


Roberto Ostinelli wrote:
> also, what's the point in doing a key/value mnesia:dirty_read on
> non-fragmented disc_copy tables instead of a 3x fasters ETS lookup?

Dirty read is location- and storage type-agnostic. This means that
you will have greater flexibility to change the storage type or
distribution pattern of the table without necessarily breaking
your code.

In some cases, this flexibility is not worth as much as the raw
speed. Personally, I always start out using transactions, and
always using mnesia:activity(Type, F). I have very rarely had to
conclude that transactions weren't fast enough for my needs.

BTW, dirty reads to _not_ support fragmented tables out of the
box. Neither does the standard mnesia:transaction(F).
You need to use mnesia:activity(Type, F, mnesia_frag).

BR,
Ulf W
-- 
Ulf Wiger
CTO, Erlang Training & Consulting Ltd
http://www.erlang-consulting.com


More information about the erlang-questions mailing list