Re: UUID v7

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: pgsql-hackers mailing list <pgsql-hackers(at)postgresql(dot)org>
Cc: "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>, Nikolay Samokhvalov <nik(at)postgres(dot)ai>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Przemysław Sztoch <przemyslaw(at)sztoch(dot)pl>, Sergey Prokhorenko <sergeyprokhorenko(at)yahoo(dot)com(dot)au>, Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>, 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-24 13:29:50
Message-ID: CAJ7c6TOAk9+9Y4o3gowNxK9hVpBOV+QFqZMzMsw5DneD4yQqvg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

> Function to extract timestamp does not provide any guarantees at all. Standard states this, see Kyzer answers upthread.
> Moreover, standard urges against relying on that if uuidX was generated before uuidY, then uuidX<uuid. The standard is doing a lot to make this happen, but does not guaranty that.
> All what is guaranteed is the uniqueness at certain conditions.
>
> > Otherwise you can calculate crc64(X) or sha256(X)
> > internally in order to generate an unique ID and claim that it's fine.
> >
> > Values that violate named invariants should be rejected with an error.
>
> Think about the value that you pass to uuid generation function as an entropy. It’s there to ensure uniqueness and promote ordering (but not guarantee).

If the standard doesn't guarantee something it doesn't mean it forbids
us to give stronger guarantees. I'm convinced that these guarantees
will be useful in real-world applications, at least the ones acting
exclusively within Postgres.

This being said, I understand your point of view too. Let's see what
other people think.

--
Best regards,
Aleksander Alekseev

In response to

  • Re: UUID v7 at 2024-01-24 13:16:09 from Andrey M. Borodin

Responses

  • Re: UUID v7 at 2024-01-24 15:29:36 from Andrey M. Borodin
  • Re: UUID v7 at 2024-01-24 21:30:33 from Sergey Prokhorenko

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2024-01-24 14:00:17 Re: Remove redundant HandleWalWriterInterrupts()
Previous Message Yugo NAGATA 2024-01-24 13:17:44 Re: pgbnech: allow to cancel queries during benchmark