Re: UUIDs generated using ossp-uuid on windows not unique - Mailing list pgsql-bugs

From Tom Lane
Subject Re: UUIDs generated using ossp-uuid on windows not unique
Date
Msg-id 6099.1213640717@sss.pgh.pa.us
Whole thread Raw
In response to UUIDs generated using ossp-uuid on windows not unique  (Meetesh Karia <meetesh.karia@gmail.com>)
Responses Re: UUIDs generated using ossp-uuid on windows not unique
List pgsql-bugs
Meetesh Karia <meetesh.karia@gmail.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

pgsql-bugs by date:

Previous
From: Meetesh Karia
Date:
Subject: UUIDs generated using ossp-uuid on windows not unique
Next
From: Stefan Kaltenbrunner
Date:
Subject: Re: UUIDs generated using ossp-uuid on windows not unique