Guids – Unique or not?
A GUID, (which may be pronounced goo-id or gwid), is a globally unique identifier.
The guid is a sequence of hexademical digits and looks something like this:
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?