Re: Sequence vs UUID

From: veem v <veema0000(at)gmail(dot)com>
To: Dominique Devienne <ddevienne(at)gmail(dot)com>, Miles Elam <miles(dot)elam(at)productops(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Sequence vs UUID
Date: 2023-02-03 16:47:57
Message-ID: CAB+=1TV7GgXzHOYhCAJO5v4FYhtZCnTy0OQ0sv3WjQsY7yraTw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Actually I did the testing by connecting to "https://dbfiddle.uk/"
postgres version -15.

PostgreSQL 15.0 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0
20210514 (Red Hat 8.5.0-10), 64-bit

Am I doing it wrong, please confirm?

On Fri, 3 Feb 2023 at 21:28, Dominique Devienne <ddevienne(at)gmail(dot)com> wrote:

> Copying the list...
>
> ---------- Forwarded message ---------
> From: Dominique Devienne <ddevienne(at)gmail(dot)com>
> Date: Fri, Feb 3, 2023 at 4:57 PM
> Subject: Re: Sequence vs UUID
> To: veem v <veema0000(at)gmail(dot)com>
>
> On Thu, Feb 2, 2023 at 8:47 PM veem v <veema0000(at)gmail(dot)com> wrote:
>
>> Tested the UUIDv7 generator for postgres as below.
>> With regards to performance , It's still way behind the sequence. [...]
>> explain analyze select count(nextval('myseq') ) from
>> generate_series(1,100000);
>> Execution Time: 59.687 ms
>>
>> explain analyze select count(gen_random_uuid()) from
>> generate_series(1,100'000);
>> Execution Time: 904.868 ms
>>
>> explain analyze select count(uuid_generate_v7()) from
>> generate_series(1,100000);
>> Execution Time: 1711.187 ms
>>
>
> Something's off regarding Guid generations IMHO...
>
> You generate 100K Guids in ~1s. While we generate (in C++, Windows
> Release, using Boost) 16M of them in +/- the same time:
>
> Enabling Performance tests
>>>>
>>>
>
>> generate 16'000'000 guids in 0.980s (user: 0.984s) 12 MB
>>>>
>>> generate 16'000'000 guids in parallel on 4 CPUs in 0.309s (user: 1.188s)
>>>> 12 MB
>>>>
>>>
> That's 2 orders of magnitude faster. Sure there's some overhead from the
> SQL, but still. Something seems fishy.
> And that's on a 2.5y old desktop. --DD
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dominique Devienne 2023-02-03 17:36:50 Re: Sequence vs UUID
Previous Message Dominique Devienne 2023-02-03 15:58:40 Fwd: Sequence vs UUID