[erlang-questions] mnesia - secondary indexes vs separate tables

Motiejus Jakštys desired.mta@REDACTED
Tue May 28 15:14:57 CEST 2013

On Tue, May 28, 2013 at 3:26 PM, John Doe <donpedrothird@REDACTED> wrote:
> Hello,
> I'm trying to do some kind of poor man's composite keys with mnesia for some
> running statistical data. What should be faster to read and write - one
> table with a few indexes or separate tables with primary key only?

Some folks did some benchmarks with mnesia with a secondary index, and
write performance was terrible (~40 times slowdown for inserts?). But
I could not find it in the archives. Who was it?

> There will be about 1-5 millions of records, approx the equal number of
> reads, inserts and deletes.
> The queries will be mostly "check if at least one record exists where given
> indexed field value = ...", "insert ...", and "delete all records where
> indexed field value=xxx". Total of 4 fields, so either one table with 4
> indexed fields, or 4 tables with key_field + counter.
> The table(s) will be disc_only_copy, as RAM matters.

On the other hand, it does not seem like too much work to measure
both. And you will have a definite answer.

Motiejus Jakštys

More information about the erlang-questions mailing list