Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are UUIDs unique across different systems?

Tags:

uuid

I'm wondering if UUIDs are unique even when they are generated on different systems, which may employ different algorithms. For instance, if you generated a bunch of UUIDs in MySQL, and .Net, would there be a higher chance of collision, or are all systems using the exact same algorithm, and thereby guaranteeing that collisions are improbable?

like image 289
Kibbee Avatar asked Apr 09 '11 02:04

Kibbee


People also ask

How many unique UUIDs are there?

A collision is possible but the total number of unique keys generated is so large that the possibility of a collision is almost zero. As per Wikipedia, the number of UUIDs generated to have atleast 1 collision is 2.71 quintillion.

How does UUID stay unique?

The UUID relies on a combination of components to ensure uniqueness. UUIDs are constructed in a sequence of digits equal to 128 bits. The ID is in hexadecimal digits, meaning it uses the numbers 0 through 9 and letters A through F.

Can two machines generate same UUID?

No, a UUID can't be guaranteed to be unique. A UUID is just a 128-bit random number. When my computer generates a UUID, there's no practical way it can prevent your computer or any other device in the universe from generating that same UUID at some time in the future.

Can 2 UUIDs be the same?

It's possible to generate an identical guid over and over. However, the chances of it happening are so low that you can assume they are unique.


1 Answers

From Universally unique identifier on Wikipedia: ..the word unique should be taken to mean "practically unique" rather than "guaranteed unique". Since the identifiers have a finite size it is possible for two differing items to share the same identifier. The identifier size and generation process need to be selected so as make this practically impossible.

like image 106
Black Frog Avatar answered Sep 19 '22 12:09

Black Frog



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!