PostgreSQL: Re: UUID v7

Re: UUID v7

> 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