Is unique id generation using UUID really unique?

后端 未结 3 748
终归单人心
终归单人心 2020-12-20 14:05

I want generate unique ID just like auto increment in java . So previously i used current nano seconds but i end up with clash since two data comes with in same nano second

3条回答
  •  天涯浪人
    2020-12-20 14:43

    While the UUIDs are not guaranteed to be unique, the probability of a duplicate is extremely low. See Random UUID probability of duplicates.

    For your application, it makes sense to use the UUID, but you may want to deal with the extremely rare condition, just in case.

提交回复
热议问题