[erlang-questions] Mnesia reads with multiple table copies

Ulf Wiger ulf.wiger@REDACTED
Wed Nov 11 11:48:17 CET 2009

Garrett Smith wrote:
> WIth Mnesia's location transparency, what is the scheme used to select
> a source for reads when there are multiple table copies? The factors
> that I imagine would be considered are:
> * local vs remote
> * ram vs disk
> * running vs stopped nodes

Yes, this is how it works.

At table load time, mnesia stores a where_to_read value
for each table in the mnesia_gvar table (an internal ets table).
This value is updated dynamically as conditions change. Local
reads are definitely favoured over remote, and RAM copies are
favoured over disc_only. The preference logic is in mnesia_lib.erl

Ulf W
Ulf Wiger
CTO, Erlang Training & Consulting Ltd

More information about the erlang-questions mailing list