Re: UUID v7

From: "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Nikolay Samokhvalov <samokhvalov(at)gmail(dot)com>, "Kyzer Davis (kydavis)" <kydavis(at)cisco(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Andrey Borodin <amborodin86(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, "brad(at)peabody(dot)io" <brad(at)peabody(dot)io>, "wolakk(at)gmail(dot)com" <wolakk(at)gmail(dot)com>, sergeyprokhorenko(at)yahoo(dot)com(dot)au
Subject: Re: UUID v7
Date: 2023-08-20 20:56:34
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> On 30 Jul 2023, at 13:08, Andrey M. Borodin <x4mmm(at)yandex-team(dot)ru> wrote:
> After discussion on GitHub with Sergey Prokhorenko [0] I understood that counter is optional, but useful part of UUID v7. It actually promotes sortability of data generated at high speed.
> The standard does not specify how big counter should be. PFA patch with 16 bit counter. Maybe it worth doing 18bit counter - it will save us one byte of PRNG data. Currently we only take 2 bits out of the whole random byte.

Here's a new patch version. Now counter is initialised with strong random on every time change (each ms). However, one first bit of the counter is preserved to zero. This is done to extend counter capacity (I left comments with reference to RFC with explanations).


Best regards, Andrey Borodin.

Attachment Content-Type Size
v4-0001-Implement-UUID-v7-as-per-IETF-draft.patch application/octet-stream 6.5 KB

In response to

  • Re: UUID v7 at 2023-07-30 10:08:41 from Andrey M. Borodin


  • Re: UUID v7 at 2023-08-21 08:42:20 from Andrey M. Borodin

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2023-08-20 22:11:24 Re: POC, WIP: OR-clause support for indexes
Previous Message Chapman Flack 2023-08-20 16:11:26 datetime from a JsonbValue