[erlang-questions] (not) understanding mnesia transactions
Scott Lystig Fritchie
Thu Jun 18 19:49:03 CEST 2009
Seth Falcon <seth@REDACTED> wrote:
sf> * On 2009-06-18 at 12:05 +0200 Dan Gudmundsson wrote:
>> The problem here lies in how mnesia handles indexes and locks on
>> If you remove the index the code works as expected.
sf> I'll take working code over fast but wrong code :-)
sf> But I'm thinking that adding the locking is the way to go since
sf> without an index the look up is a full table scan.
I have a comment that may or may not apply to Seth, but it's worth
noting by all Mnesia users...
... Mnesia secondary indexes are *not ordered*. Queries that require
anything but an exact key lookup in a secondary index will instead scan
the entire secondary index. Which, if memory serves correctly, will
take a table lock. See the top of mnesia:info() (or related) to watch
locking behavior, if reading code isn't fun enough :-).
More information about the erlang-questions