Generating unique ids in Mnesia

Mark Scandariato <>
Thu Aug 18 17:29:04 CEST 2005

If you don't mind gaps in the sequence numbers, then try:

seq() ->
    {M,S,U} = erlang:now(),
    <<N:64>> = <<M:24, S:20, U:20>>,


-----Original Message-----
From: Joel Reymont <>
Sent: Aug 18, 2005 11:12 AM
To: Erlang Users' List <>
Subject: Re: Generating unique ids in Mnesia


Thanks for the tip but I need sequential, increasing numerical  
values. I would like my records to be sequantially numbered and the  
sequence number to increase every time I insert a record. How do I  
manage that?


On Aug 18, 2005, at 4:46 PM, Hakan Mattsson wrote:

> You can use
>   erlang:now()
> or
>   {node(), erlang:now()}
> in a multi node system.

More information about the erlang-questions mailing list