Database / Mnesia intermediate to advanced Interview questions
When would you use a local_content table instead of a normal replicated table?
Reach for local_content specifically when the data is conceptually per-node rather than
shared — each node's copy is meant to hold genuinely different information, not a synchronized replica of
the same logical dataset. A normal replicated table is the wrong fit here since it's designed around every copy
converging on identical content.
mnesia:create_table(node_health, [{ram_copies, [node()]}, {local_content, true}, {attributes, [check, status, checked_at]}]).
Typical examples: recording each node's own health-check results, keeping a node-local request cache that
doesn't need to match other nodes' caches, or logging events specific to that node's own activity. If you find
yourself wanting the exact same data visible identically from every node, that's the signal you actually want
a normal replicated table, not local_content.
More Related questions...