[erlang-questions] mnesia: composite keys?

Peter Sabaini <>
Fri Jan 9 22:45:03 CET 2009

Hello list,

I've read[1] that mnesia doesn't support composite keys. It seems I can use 
keys made up of tuples though:

()11> mnesia:create_table(test, [{attributes, [id, data]}]).
()19> Ins = fun() -> mnesia:write({test, {a_key, 0}, "asdfasdf"}) 
()20> mnesia:transaction(Ins).
()21> R = fun() -> mnesia:read(test, {a_key, 0}) end.
()22> mnesia:transaction(R).

Is tuples as keys common practice or A Really Bad Idea(tm)?


[1] http://www.erlang.org/pipermail/erlang-questions/2008-February/032903.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090109/069ca1ce/attachment.bin>

More information about the erlang-questions mailing list