Is a GUID unique 100% of the time?

前端 未结 22 2556
孤独总比滥情好
孤独总比滥情好 2020-11-22 01:31

Is a GUID unique 100% of the time?

Will it stay unique over multiple threads?

22条回答
  •  既然无缘
    2020-11-22 02:23

    The hardest part is not about generating a duplicated Guid.

    The hardest part is designed a database to store all of the generated ones to check if it is actually duplicated.

    From WIKI:

    For example, the number of random version 4 UUIDs which need to be generated in order to have a 50% probability of at least one collision is 2.71 quintillion, computed as follows:

    enter image description here

    This number is equivalent to generating 1 billion UUIDs per second for about 85 years, and a file containing this many UUIDs, at 16 bytes per UUID, would be about 45 exabytes, many times larger than the largest databases currently in existence, which are on the order of hundreds of petabytes

提交回复
热议问题