[erlang-questions] Mnesia transactions and locking
Ulf Wiger (TN/EAB)
Tue Jun 12 15:01:21 CEST 2007
Table locks are used for searches (unless mnesia
can figure out that the key is bound in your
select() or match_object() call, I believe).
Record locks are used for individual reads and
If you know that you'll make lots of writes to
the same table from within a transaction, it
may speed things up significantly if you first
take a table lock, but mnesia doesn't support
any heuristics to figure that out automatically.
> -----Original Message-----
> From: Joel Reymont [mailto:joelr1@REDACTED]
> Sent: den 12 juni 2007 14:22
> To: Ulf Wiger (TN/EAB)
> Cc: Erlang Questions
> Subject: Re: [erlang-questions] Mnesia transactions and locking
> On Jun 12, 2007, at 12:48 PM, Ulf Wiger (TN/EAB) wrote:
> > It acquires locks as it goes along, or when the user
> specifically asks
> > for a lock.
> This is a fine description but how does Mnesia determine
> whether to lock a table or a record?
> From my inspection of the sources it seems that a table lock
> is used for writes and record locks are used for certain
> types of reads.
> Is this correct? Is a table lock always used for writing?
> Thanks, Joel
> http://topdog.cc - EasyLanguage to C# translator
> http://wagerlabs.com - Blog
More information about the erlang-questions