4 ms·
> The remaining of the UUID value comes from the MD5 of a random value and the current time at a precision of 1us. I might be misunderstanding something here b
by damagednoob 5y ago
> The remaining of the UUID value comes from the MD5 of a random value and the current time at a precision of 1us.
I might be misunderstanding something here but if your random seed is based on time, under high-concurrency, doesn't this risk collisions? I can't see any thread-safety guarantees in the documentation.[1]
[1] https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_rand https://dev.mysql.com/doc/refman/8.0/en/mathematical-functio...
- hashimotonomora 5y agoIf the column is UNIQUE there’s no collisions it will just fail to INSERT.
- damagednoob 5y agoThen it doesn't have the same quality as a UUID which is supposedly guaranteed to be unique across space _and_ time[1]. [1] https://datatracker.ietf.org/doc/html/rfc4122 https://datatracker.ietf.org/doc/html/rfc4122
- hashimotonomora 5y agoIt’s not guaranteed, it’s just extremely probable that it’s unique given that its generation follows a uniformly random distribution.