Answer the question
In order to leave comments, you need to log in
How to correctly generate an ID in Yandex Database?
Hello!
I read the documentation in Yandex Cloud Yandex Database, I realized that I need to generate an evenly distributed primary key. I did not find any functions in the docks to create an ID.
Google didn't turn up any results either.
Is there any established practice for newsql? Or is it just possible to take uuid?
As an example, they show the usual int for id.
Answer the question
In order to leave comments, you need to log in
As Anton Shamanov advises to take a timestamp or pre-calculate: (select max (id)) + 1, Yandex does not recommend:
... As a consequence of this rule, you should not use a monotonically increasing sequence, for example, timestamp, as the primary key of a table.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question