Guids – Unique or not?
The guid is a sequence of hexademical digits and looks something like this:
4F3104E0-3F89-12D3-7A0C-0405A82D3402
I’ve heard developers say that it is unique world-wide, yep, globally. But is it? I decided to do some research and find out based on other’s experience.
Wikipedia says “While each generated GUID is not guaranteed to be unique, the total number of unique keys (2128 or 3.4×1038) is so large that the probability of the same number being generated twice is very small.”
Hmm. Okay. But how about real-world experience? I am still skeptical. I find this sentence about GUIDs in an article by Scott Mitchell. A reader of Scott’s, Rusty Alderson, shares:
"In creating very large databases, GUIDs (as generated by MS's NEWID() function) WILL have collisions, or duplicates. In a previous project where I was building a large Customer ODS (Operational Data Store), I typically found about 4 collisions per million rows. Code has to be developed to handle this. This was in SQL Server 2000. Perhaps SQL Server 2005 has remedied this."
So there you have it. GUIDs are not globally unique. So now that we are in SQL Server 2008, what’s the verdict? Anyone working with millions of rows having collisions?