Re: UUID v7

Sergey Prokhorenko <sergeyprokhorenko@yahoo.com.au>

From: Sergey Prokhorenko <sergeyprokhorenko@yahoo.com.au>
To: Jelte Fennema-Nio <postgres@jeltef.nl>, "Andrey M. Borodin" <x4mmm@yandex-team.ru>
Cc: pgsql-hackers mailing list <pgsql-hackers@postgresql.org>, Aleksander Alekseev <aleksander@timescale.com>, Przemysław Sztoch <przemyslaw@sztoch.pl>, Nikolay Samokhvalov <nik@postgres.ai>, "David G. Johnston" <david.g.johnston@gmail.com>, Nick Babadzhanian <pgnickb@gmail.com>, Mat Arye <mat@timescaledb.com>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, Tom Lane <tgl@sss.pgh.pa.us>, Daniel Gustafsson <daniel@yesql.se>, Matthias van de Meent <boekewurm+postgres@gmail.com>, Nikolay Samokhvalov <samokhvalov@gmail.com>, "Kyzer Davis (kydavis)" <kydavis@cisco.com>, Andres Freund <andres@anarazel.de>, "brad@peabody.io" <brad@peabody.io>, Kirk Wolak <wolakk@gmail.com>
Date: 2024-01-30T07:28:28Z
Lists: pgsql-hackers
Andrey,

I think this phrase is outdated: "This function can optionally accept a timestamp used instead of current time.This allows implementation of k-way sotable identifiers."
This phrase is wrong: "Both functions return a version 4 (random) UUID."
For this phrase the reason is unclear and the phrase is most likely incorrect:
if large batches of UUIDs are generated at the+   same time it's possible that some UUIDs will store a time that is slightly later+   than their actual generation time

Sergey Prokhorenko

sergeyprokhorenko@yahoo.com.au 

    On Tuesday, 30 January 2024 at 09:55:04 am GMT+3, Andrey M. Borodin <x4mmm@yandex-team.ru> wrote:  
 
 

> On 30 Jan 2024, at 01:38, Jelte Fennema-Nio <postgres@jeltef.nl> wrote:
> 
> 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.

PFA v15. Changes: removed timestamp argument, incorporated Jelte’s documentation addons.

Thanks!


Best regards, Andrey Borodin.
  

Commits

  1. Fix timestamp overflow in UUIDv7 implementation.

  2. Add UUID version 7 generation function.

  3. Add some UUID support functions