Mnesia and additional indexes: a cautionary tale

Scott Lystig Fritchie fritchie@REDACTED
Thu Mar 30 22:25:29 CEST 2006


>>>>> "rvg" == Rudolph van Graan <rvg@REDACTED> writes:

>> The "beam" process size should've been about 1,400KB with
>> everything loaded.  But the process size was only 390MB, and "beam"
>> was still using 100% CPU time ... doing something, I dunno what!

rvg> When this happens, it is mostly DETS related processes running
rvg> doing... what?

The tables are disc_copies, so DETS isn't involved.  But as another
followup explained, the Mnesia secondary index is implemented as a
bag, and insertion time is linear.  

rvg> I guess you mean all the entries have the same term in position
rvg> 5.

rvg> So in essence you suggest this happens when a lot of records
rvg> contain the same value in an indexed field?

Correct.  Doing that linear insert 200K times can officially be called
"slow", as far as I'm concerned.  :-)  It's nice to know that I'm not
the only person who's had that problem ... for some value of "nice".

rvg> Last question - is this running Windows as host OS?

Nope, Linux.  Though I'd expect this particular problem to bite Erlang
on any platform.

-Scott



More information about the erlang-questions mailing list