On 6 January 2011 00:32, dennis jenkins <dennis.jenkins...@gmail.com> wrote:
> On Wed, Jan 5, 2011 at 1:03 PM, Bill Moran <wmo...@potentialtech.com> > wrote: > > > > But the point (that you are trying to sidestep) is that the UUID > namespace > > is finite, so therefore you WILL hit a problem with conflicts at some > point. > > Just because that point is larger than most people have to concern > themselves > > with isn't an invalidation. > > The UUID itself is 128 bits. Some of those bits are pre-determined. > I don't recall, but I think that a "normal" UUID has 121 bits of > randomness. > > How many would one have to store in a database before a collision > would even be a concern. Such a database would be freaking huge. > Probably far larger than anything that anyone has. > Not necessarily. Bad luck: two inserts, and one collision. Good luck: many many inserts, without any collision. If you have ten pairs of socks... how many do you need to choose, to have two from the same pair (to have a collision)? Good luck: 2 Bad luck: 11 With uuid you can write a program that most of the time works correctly, but sometimes not. If you need a program that works correctly all the time, you can use UUID, with the overhead of a procedure, that checks the collisions, and does something with that, or you could generate the PK without UUID, and be sure that the generator won't have collisions, just because it is a normal sequence. regards Szymon