Re: UUID v7

From: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>
To: "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>
Cc: Sergey Prokhorenko <sergeyprokhorenko(at)yahoo(dot)com(dot)au>, pgsql-hackers mailing list <pgsql-hackers(at)postgresql(dot)org>, Aleksander Alekseev <aleksander(at)timescale(dot)com>, Przemysław Sztoch <przemyslaw(at)sztoch(dot)pl>, Nikolay Samokhvalov <nik(at)postgres(dot)ai>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Nick Babadzhanian <pgnickb(at)gmail(dot)com>, Mat Arye <mat(at)timescaledb(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, 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>, "brad(at)peabody(dot)io" <brad(at)peabody(dot)io>, Kirk Wolak <wolakk(at)gmail(dot)com>
Subject: Re: UUID v7
Date: 2024-01-29 20:38:27
Message-ID: CAGECzQTVi1JUE43uisQ+uKz46bQ+e+uwR9PUsmNfo2rjKaqwoA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 29 Jan 2024 at 19:32, Andrey M. Borodin <x4mmm(at)yandex-team(dot)ru> wrote:
> Even if the developer pass constant time to uuidv7(T) they will get what they asked for - unique identifier. Moreover - it still will be keeping locality. There will be no negative consequences at all.

It will be significantly "less unique" than if they wouldn't pass a
constant time. Basically it would become a UUIDv4, but with 74 bits of
random data instead of 122. That might not be enough anymore to
"guarantee" uniqueness. I guess that's why it is required to use
UUIDv8 in these cases, because correct usage is now a requirement for
assuming uniqueness. And for UUIDv8 the spec says this:

> UUIDv8's uniqueness will be implementation-specific and MUST NOT be assumed.

> > On 29 Jan 2024, at 18:58, Junwang Zhao <zhjwpku(at)gmail(dot)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 :)

As an FYI, there is an RFC that defines these keywords that's why they
are capital letters: https://www.ietf.org/rfc/rfc2119.txt

> I believe it's kind of a big deficiency that k-way sortable identifiers are not implementable on top of UUIDv7. Well, let's go without this function. UUIDv7 is still an improvement over previous versions.

Yeah, I liked the feature to generate UUIDv7 based on timestamp too.
But following the spec seems more important than a nice feature to me.

In response to

  • Re: UUID v7 at 2024-01-29 18:32:38 from Andrey M. Borodin

Responses

  • Re: UUID v7 at 2024-01-30 06:54:48 from Andrey M. Borodin

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2024-01-29 20:38:50 Re: Should we remove -Wdeclaration-after-statement?
Previous Message Robert Haas 2024-01-29 20:18:50 Re: cleanup patches for incremental backup