[erlang-questions] Mnesia and autogenerated ids

Ulf Wiger ulf@REDACTED
Fri Aug 8 10:34:29 CEST 2008

2008/8/8 zambal <zambal@REDACTED>:
> On Aug 7, 11:19 pm, "Ulf Wiger" <u...@REDACTED> wrote:
>> Now is guaranteed to be unique on a given node, while that node is
>> running. Two different nodes can easily* generate the same now()
>> value. That's why {node(), now()} is used.
>> Of course, if the node is restarted and the system clock is altered,
>> you can still have duplication of IDs*. This problem can be addressed
>> by using NTP against a reliable time reference.
> Thanks for the explanation. So if you would have one node that is
> responsible generating new id's and all other nodes in your
> application query this node, is there any other reason to not use
> now()?

Add the requirement to have a well synchronized system clock. (:

Given the right circumstances, now() can work well as a unique id
on its own.


More information about the erlang-questions mailing list