Mnesia whole table locked

Hakan Mattsson hakan@REDACTED
Thu Dec 11 18:48:10 CET 2003

Carlos> Hi, I've found  in a mnesia:info(). (see attach) a lot of
Carlos> Lock: {{tarifftable,'______WHOLETABLE_____'},
Carlos> My questions:
Carlos> 1. Why does it happen?

All operations that performs an exhaustive search of
a Mnesia table can potentially grab a table lock.

Typically it is operations like mnesia:match_object/3,
mnesia:fold/3 and friends, but also Mnemosyne queries.

Carlos> 2. How can I prevent this situation?
Carlos> 3. How can I solve this?

You need to analyze the access patterns that you have in your

Avoid exhaustive searches in Mnesia in general and Mnemosyne in
particular. Try to use key based lookup as far as possible (use
mnesia:match_object/3 with a bound key or mnesia:read/2 directly). You
could also consider dirty access if you have other means of
synchronizing your access of the database.

Carlos> since my Mnesia data base is behaving a little strange since then

What do you mean with behaving strange?


Håkan Mattsson
High Availability Software, DBMS Internals

More information about the erlang-questions mailing list