Fwd: Sequence vs UUID - Mailing list pgsql-general

From Dominique Devienne
Subject Fwd: Sequence vs UUID
Date
Msg-id CAFCRh-8EuCSZ=M91VN13gnixiHPPRWreWsRboCEL0d-TUsnjRA@mail.gmail.com
Whole thread Raw
In response to Sequence vs UUID  (veem v <veema0000@gmail.com>)
Responses Re: Sequence vs UUID
List pgsql-general
Copying the list...

---------- Forwarded message ---------
From: Dominique Devienne <ddevienne@gmail.com>
Date: Fri, Feb 3, 2023 at 4:57 PM
Subject: Re: Sequence vs UUID
To: veem v <veema0000@gmail.com>

On Thu, Feb 2, 2023 at 8:47 PM veem v <veema0000@gmail.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

pgsql-general by date:

Previous
From: Miles Elam
Date:
Subject: Re: Sequence vs UUID
Next
From: veem v
Date:
Subject: Re: Sequence vs UUID