[erlang-questions] Mnesia and automatic generation of primary keys
Mon Jul 2 13:35:16 CEST 2007
I usually use
when I need a persistently unique key.
It also functions as a timestamp, letting you
derive the creation time from the key.
2007/7/2, Matej Kosik <>:
> The best tutorial to using Mnesia I have found is this document:
> According to that information I was able to set up a database, add tables, entries and make some querries. Ok.
> Now when I am thinking about tables I need and their attributes, I would like to generate unique primary keys for new entries to certain tables (where none of their attributes is a clear candidate for primary key).
> Is there a lucid way to generate such primary keys (that will guarantee uniqueness of those keys during the whole lifetime of that table) regardless of how many times the system will be shut down and restarted. Do you also have this problem? How do you solve it?
> Should I set up some kind of global table where I can use "last used primary key (integer)" and gradually increment it as I will acquire new keys? Or can this information be somehow associated with particular tables (stored in a schema as an attribute of that table)?
> Matej Kosik
> erlang-questions mailing list
More information about the erlang-questions