Re: UUIDs generated using ossp-uuid on windows not unique

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: meetesh(dot)karia(at)alumni(dot)duke(dot)edu
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: UUIDs generated using ossp-uuid on windows not unique
Date: 2008-06-16 18:25:17
Message-ID: 6099.1213640717@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Meetesh Karia <meetesh(dot)karia(at)gmail(dot)com> writes:
> As best as I can tell, the problem is caused because generation of v1
> UUIDs uses GetSystemTimeAsFileTime which is stated to have a resolution
> of 100 nanoseconds but in practice has a resolution of around 15ms
> (http://www.ddj.com/showArticle.jhtml?documentID=win0305a&pgno=17).

Well, any real-time clock reading is going to have finite resolution.
If your app is expecting that version-1 UUIDs generated in rapid
succession will be distinct, I think your app is broken. It's just
a little more obvious on Windows :-(.

Perhaps the v4 generation method would work better for you?

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Stefan Kaltenbrunner 2008-06-16 20:01:57 Re: UUIDs generated using ossp-uuid on windows not unique
Previous Message Meetesh Karia 2008-06-16 17:03:09 UUIDs generated using ossp-uuid on windows not unique