Database / Mnesia basics Interview questions
How do you delete a record from a Mnesia table?
mnesia:delete/1 removes the record matching a given key, run inside a transaction just like
write/1 and read/1, so the deletion participates in the same atomicity and locking
guarantees.
mnesia:transaction(fun() -> mnesia:delete({person, 1}) end).
There's also mnesia:delete_object/1, which deletes a specific record by matching its full
content rather than just its key — useful on bag tables where multiple records can share
the same key and you only want to remove one particular one. A fast, non-transactional
mnesia:dirty_delete/1 is also available, following the same speed-versus-consistency tradeoff as
other dirty operations.
More Related questions...