[erlang-questions] [clarify] mnesia slowdown with extra indexes ???
Zoltan Peter Toth
zoltan.peter.toth@REDACTED
Mon Mar 2 12:49:26 CET 2009
Hi,
I made some test on mnesia object matching on non-key attributes.
Got a table like this:
mnesia:table_info(tgccDevIdToTerminationTable,size).
27000
mnesia:table_info(tgccDevIdToTerminationTable,attribute.)
[deviceId,terminationId,sessionId,mgId,deviceChar, deviceBitMask,chId]
No extra index exists.
A match on the mgId attrib gives:
element(1,timer:tc(mnesia,dirty_match_object,[tgccDevIdToTerminationTable,
{'_','_','_','_',200021,'_','_','_'}])).
5578
5612
5571
6064
5622
Now I added an index on the mgId:
mnesia:add_table_index(tgccDevIdToTerminationTable,
mgId).
{atomic,ok}
...and the matches slowed down:
6542
6420
6302
6430
6519
This is determinitstic. If I remove the extra index, it becomes faster
again.
The same even if specifying the index explicitly with
dirty_index_match_object().
This is a live system with all the mnesia nodes up. R12B on quad core.
Any comment on this ? Or is a table with 27000 rows too little to take
advantage of the
extra index ???
Br,
TZP.
More information about the erlang-questions
mailing list