[erlang-questions] Mnesia and autogenerated ids

zambal zambal@REDACTED
Thu Aug 7 22:57:49 CEST 2008



On Aug 7, 9:57 pm, "Christian S" <chs...@REDACTED> wrote:
> To summarize,
>
>  * use {node(), now()} as the least-effort approach
>
>  * more effort: create a mnesia table {sequences, TableName, Serial}
> with a row per table, increment numeric id in it for a new id
>
>  * even more effort, have each node allocate many ids directly, and
> use them up in subsequent transactions on that node before you get a
> chunk again. this is to lower total amount of transactions to the
> sequence table.
>
> If you can, there is the possibility to erlang:md5 on some data in
> that row record, and using the md5 as a unique primary key.

If the only requirement of an ID is to be unique, why would you choose
for another method than using now()?

Or in other words, what are possible drawbacks of using now() as a
unique ID generator?

Best,
Vincent








More information about the erlang-questions mailing list