Database / Mnesia intermediate to advanced Interview questions
What is the where_to_read table_info item used for?
mnesia:table_info(Table, where_to_read) returns which node the local Mnesia instance would
currently read that table from — useful for diagnosing read-routing behavior directly, rather than
inferring it indirectly from latency measurements.
mnesia:table_info(session, where_to_read). %% -> node() | 'nonode@nohost' (no copy currently reachable) | some_remote_node@host
If it returns the local node itself, reads are being served locally with no network involved; if it returns a remote node, every read for that table is crossing the network to reach it, which is worth knowing when investigating unexpectedly high read latency on a specific table. It's mainly a diagnostic tool for understanding cluster behavior at a point in time, not something application logic typically branches on directly.
More Related questions...