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
  • 25,575
  • 21
  • 68
  • 72
mohammad
  • 75
  • 5

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,559
  • 1
  • 7
  • 15