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-21 08:42:20
Message-ID: 3BDCCF0B-9C96-416C-87F6-071ABD7AED8B@yandex-team.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 20 Aug 2023, at 23:56, Andrey M. Borodin <x4mmm(at)yandex-team(dot)ru> wrote:
>
> <v4-0001-Implement-UUID-v7-as-per-IETF-draft.patch>

I've observed, that pre-generating and buffering random numbers makes UUID generation 10 times faster.

Without buffering
postgres=# with x as (select gen_uuid_v7() from generate_series(1,1e6)) select count(*) from x;
Time: 5286.572 ms (00:05.287)

With buffering
postgres=# with x as (select gen_uuid_v7() from generate_series(1,1e6)) select count(*) from x;
Time: 390.091 ms

This can speed up gen_random_uuid() on the same scale too. PFA implementation of this technique.

Best regards, Andrey Borodin.

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

In response to

  • Re: UUID v7 at 2023-08-20 20:56:34 from Andrey M. Borodin

Responses

  • Re: UUID v7 at 2023-08-30 19:04:46 from Andrey M. Borodin

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2023-08-21 09:16:21 Re: [dsm] comment typo
Previous Message Dean Rasheed 2023-08-21 08:31:37 Re: [PATCH] Add function to_oct