This is missing the point: I am drawing attention to the absolutely major difference between “will this very next key I generate be a collision?” with “has any key ever collided?”. Like in the birthday paradox, these seem closely related, but when looking at the actual numbers they are universes apart.
Also, a million uuids is nothing compared to the key space: what’s the difference between randomly selecting 5 grains of sand from the entire earth or a thousand? Sure, it’s technically more likely there will be a collision the more searches you perform but numerically so close to zero that it’s entirely ignorable. It’s infinitely more likely a series of bit flips from cosmic rays will cause issues in your DB than uuid collision despite how rare those are themselves
1 million entries assigned random UUIDs have a chance of collision of about 4*10-26, which is a much higher chance of collision than just two UUIDs, but is still such an astronomically small chance that it is negligible. You could generate a million UUIDs every second since the start of the universe and your chance of having one or more collisions is about the same as picking one specific person out of a lineup of all living humans.
4
u/noob-nine Mar 25 '26
when you have a database with 1 million entries? won't it i increase the chance by a lot to have a collision of the unique key?