Answer the question
In order to leave comments, you need to log in
Where is the best place to generate a uuid for a base? In code or in sql query?
Well, the whole question is in the title. You need to generate uuid for primary keys. It is better to generate in the code or in the request by the function.
In general, one gets the feeling that there is no difference, but still decided to clarify.
Answer the question
In order to leave comments, you need to log in
By and large, it doesn't matter.
But it strongly depends on how the UUID is generated on the client.
For example, when using rand based on time, I encountered a uniqueness problem when inserting records densely into the database (with a record density of more than 10K per sec, this error will manifest itself stably).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question