Database / Mnesia basics Interview questions
What is mnesia:table_info/2 used for?
mnesia:table_info(Table, Item) returns a specific, structured piece of metadata about a table
— its size, storage type, attribute list, index list, and more — suitable for use in application
code, unlike the human-readable printout from mnesia:info/0.
mnesia:table_info(person, size). %% -> 42 mnesia:table_info(person, disc_copies). %% -> [node1@host, node2@host] mnesia:table_info(person, attributes). %% -> [id, name, age]
This is the function you'd reach for programmatically — for example, checking a table's current size
before deciding whether to run a bulk migration, or verifying which nodes currently hold a copy before
performing a maintenance operation — rather than parsing the free-form text that mnesia:info/0
prints for humans in a shell.
More Related questions...