[erlang-questions] Unable to start mnesia DB.

Dan Gudmundsson dangud@REDACTED
Tue Apr 15 09:40:29 CEST 2014

That is how bag tables in ets are implemented, which is why index is slow
if your secondary keys are equal,
the same thing applies to ordinary bag-tables, if many primary keys are


On Tue, Apr 15, 2014 at 6:57 AM, Karolis Petrauskas

> Hi,
> Recently this problem reappeared: my mnesia DB started to load very
> slowly. The main problem was single disc_copies table with ~500k small
> records. This time it was loading for 35 minutes. This table is of
> type "bag" and has one secondary index.
> Based on previous emails, I assumed that the problems are caused by
> the index. I dropped the index, altrough observed no notable
> improvement (in startup time). Then I changed table to
> disc_only_copies. The DB started to load fast (<1min) event with
> secondary index (I have recreated it).
> Another strange thing here is that the mnesia:foldl/3 for this table
> was very slow. I was just copying several fields from this table to
> another table. I have aborted this operation after waiting for several
> hours. The foldl operation completed in ~2 minutes after i changed the
> source table type from disc_copies to disc_only_copies.
> Currently I think the problem is related to uniqueness of the key in
> the table. For some time the application worked so, that each key had
> not more than 100 records per key (the table is of type "bag").
> Recently the application started to generate more records (1k or event
> 10k) per key.
> Is it normal/expected behaviour of Mnesia, or should I try to create
> scripts for reproducing this problem and report it as a bug?
> The application is running on Erlang R16B02 on Debian OS.
> Karolis
> On Sun, Jul 14, 2013 at 10:59 PM, Karolis Petrauskas
> <k.petrauskas@REDACTED> wrote:
> > Hi,
> >
> >     Thanks for your response. I have 1 secondary index in the entire
> > DB. I will try to load the DB with the index dropped.
> >
> > Karolis
> >
> > On Fri, Jul 12, 2013 at 10:12 AM, Ignas Vyšniauskas <baliulia@REDACTED>
> wrote:
> >> On 07/09/2013 07:16 PM, Karolis Petrauskas wrote:
> >>> After the DB become available, I stopped the node by invoking
> >>> init:stop(). Then I repeated the test. It is still running, but
> >>> timings look the same (2 cores were busy for 2.5 hours, and after
> >>> that 1 core is loaded fully, expected for ~5.5 hours). For the second
> >>> start up attempt the DB has no DCL files, only DCD are left after
> >>> first load.
> >>
> >> A poke in the dark: do you maybe have lots of secondary indices? These
> >> will not be stored on disk and so will be recreated each time the tables
> >> are loaded, I've experienced very long mnesia startup times in such
> >> cases. Otherwise -- no idea.
> >>
> >> --
> >> Ignas
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140415/8068c4eb/attachment.htm>

More information about the erlang-questions mailing list