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@xxxxxxxxx> wrote:
Copying the list...---------- Forwarded message ---------
From: Dominique Devienne <ddevienne@xxxxxxxxx>
Date: Fri, Feb 3, 2023 at 4:57 PM
Subject: Re: Sequence vs UUID
To: veem v <veema0000@xxxxxxxxx>On Thu, Feb 2, 2023 at 8:47 PM veem v <veema0000@xxxxxxxxx> 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 msSomething'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 testsgenerate 16'000'000 guids in 0.980s (user: 0.984s) 12 MBgenerate 16'000'000 guids in parallel on 4 CPUs in 0.309s (user: 1.188s) 12 MBThat'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