0

I am making UUIDs like this:

Uuid::uuid4(); 

and save in a database as track id.

Is it possible to create a duplicate UUID?

1
  • How is this a duplicate? One question is about Java, this one about php/laravel. Some answers that put the probabilities into perspective have valid information for both questions, but the true answer will take into account the quality of the implementation. Commented Nov 22, 2023 at 13:16

1 Answer 1

0

If you are not using a unique column, then you can look up the UUID from the database and save it in another record. You cannot feasibly generate a duplicate UUID using Uuid:uuid4() without astronomical odds, however.

If you intend to use the UUID as a unique identifier, best practice would be to also add a unique constraint on your database column.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.