Generating unique ids in Mnesia

Rick Pettit <>
Thu Aug 18 16:58:31 CEST 2005

On Thu, Aug 18, 2005 at 04:40:33PM +0200, Joel Reymont wrote:
> Folks,
> I need to maintain a table of players in Mnesia and I would like to  
> assign players a unique id when they are added. Right now I generate  
> a tuple of {timestamp hash, pid hash} and then hash that once more to  
> get a unique id.
> Is there an easier way to do this in Mnesia? The ids can be  
> sequential or random, they just can't repeat themselves as the table  
> is a set. I guess I'm looking for something like a max aggregator on  
> a Mnesia column.

Will a plain old ref work, the kind returned by erlang:make_ref()?


More information about the erlang-questions mailing list