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?

Shaido
  • 27,497
  • 23
  • 70
  • 73
mohammad
  • 95
  • 7

1 Answers1

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.

brice
  • 1,801
  • 1
  • 10
  • 15