Re: UUID v7
От | Andrey M. Borodin |
---|---|
Тема | Re: UUID v7 |
Дата | |
Msg-id | 5932FFF8-4E5F-44DC-8FEA-22E8302759C7@yandex-team.ru обсуждение исходный текст |
Ответ на | Re: UUID v7 (Sergey Prokhorenko <sergeyprokhorenko@yahoo.com.au>) |
Ответы |
Re: UUID v7
Re: UUID v7 |
Список | pgsql-hackers |
> On 25 Jan 2024, at 22:04, Sergey Prokhorenko <sergeyprokhorenko@yahoo.com.au> wrote: > > Aleksander, > > In this case the documentation must state that the functions uuid_extract_time() and uuidv7(T) are against the RFC requirements,and that developers may use these functions with caution at their own risk, and these functions are not recommendedfor production environment. Refining documentation is good. However, saying that these functions are not recommended for production must be based onsome real threats. > > The function uuidv7(T) is not better than uuid_extract_time(). Careless developers may well pass any business date intothis function: document date, registration date, payment date, reporting date, start date of the current month, datadownload date, and even a constant. This would be a profanation of UUIDv7 with very negative consequences. Even if the developer pass constant time to uuidv7(T) they will get what they asked for - unique identifier. Moreover - itstill will be keeping locality. There will be no negative consequences at all. On the contrary, experienced developer can leverage parameter when data locality should be reduced. If you have serveralstreams of data, you might want to introduce some shift in reduce contention. For example, you can generate uuidv7(now() + '1 day' * random(0,10)). This will split 1 contention point to 10 and increaseingestion performance 10x-fold. > On 29 Jan 2024, at 18:58, Junwang Zhao <zhjwpku@gmail.com> wrote: > > If other timestamp sources or > a custom timestamp epoch are required, UUIDv8 MUST be used. Well, yeah. RFC says this... in 4 capital letters :) I believe it's kind of a big deficiency that k-way sortable identifiersare not implementable on top of UUIDv7. Well, let's go without this function. UUIDv7 is still an improvement overprevious versions. Jelte, your documentation corrections looks good to me, I'll include them in next version. Thanks! Best regards, Andrey Borodin.
В списке pgsql-hackers по дате отправления: