Re: UUID v7

From: "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>
To: Andrey Borodin <amborodin86(at)gmail(dot)com>
Cc: Jelte Fennema <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>, 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: 2024-01-02 09:17:42
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> On 9 Oct 2023, at 23:46, Andrey Borodin <amborodin86(at)gmail(dot)com> wrote:

Here's next iteration of the patch. I've added get_uuid_v7_time().
This function extracts timestamp from uuid, iff it is v7. Timestamp correctness only guaranteed if the timestamp was generated by the same implementation (6 bytes for milliseconds obtained by gettimeofday()).
Tests verify that get_uuid_v7_time(gen_uuid_v7()) differs no more than 1ms from now(). Maybe we should allow more tolerant values for slow test machines.

Best regards, Andrey Borodin.

Attachment Content-Type Size
v7-0001-Implement-UUID-v7-as-per-IETF-draft.patch application/octet-stream 9.0 KB
v7-0003-Use-cached-random-numbers-in-gen_random_uuid-too.patch application/octet-stream 822 bytes
v7-0002-Buffer-random-numbers.patch application/octet-stream 2.0 KB

In response to

  • Re: UUID v7 at 2023-10-09 18:46:06 from Andrey Borodin


  • Re: UUID v7 at 2024-01-02 18:18:09 from Andrey M. Borodin

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2024-01-02 09:23:09 Re: Synchronizing slots from primary to standby
Previous Message jian he 2024-01-02 08:18:00 Re: Extract numeric filed in JSONB more effectively