1

Is the best solution to use UUID() function in db script in order to generate UUIDs for column or there are better solutions? Because when I tried to test it on my db it generated guids but they are similar:

fb55b9f1-dc80-11e5-9332-000c2931ded6
fb55bba4-dc80-11e5-9332-000c2931ded6

Only first 8 symbols different. So what should be better solution for this ?

I used this script: UPDATE Table set GUID = uuid();

JohnnyHK
  • 305,182
  • 66
  • 621
  • 471
Uoj
  • 45
  • 1
  • 3

1 Answers1

0

The idea of UUID/GUID is to be unique in your global context, what now is your database. The fact that they are similar shouldn't bother you. I would stick with the mongo's implementation just because it is simple to use, nothing external is required, and all uuid-s should implement the same standard.

If you're interested in the probability of duplicates check out these questions:Collision probability of ObjectId vs UUID in a large distributed system, Possibility of duplicate Mongo ObjectId's being generated in two different collections?.

Community
  • 1
  • 1
Pio
  • 4,044
  • 11
  • 46
  • 81