[erlang-questions] Can one have more than one secondary index on a mnesia table?

Martin Karlsson martin@REDACTED
Tue Oct 24 00:56:31 CEST 2017

>Am I doing something wrong? Or is there something I should be doing altogether?

Your second index_read is not correct:

>mnesia:index_read({?TABLE, Penname, 5})

Should be:
mnesia:index_read/3 i.e

mnesia:index_read(?TABLE, Penname, 5).

I also tend to use the names rather than index position for the queries.

mnesia:index_read(?TABLE, Penname, #yourrecord.penname).


More information about the erlang-questions mailing list