[erlang-questions] Mnesia reads with multiple table copies

Garrett Smith g@REDACTED
Wed Nov 11 15:37:01 CET 2009

On Wed, Nov 11, 2009 at 4:48 AM, Ulf Wiger
<ulf.wiger@REDACTED> wrote:
> 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


I see now also that you can get the info using:

  mnesia:table_info(Tab, where_to_read)

More information about the erlang-questions mailing list