Re: Sequence Access Methods, round two

From: Andrei Lepikhov <lepihov(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Xuneng Zhou <xunengzhou(at)gmail(dot)com>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>
Subject: Re: Sequence Access Methods, round two
Date: 2026-05-19 13:11:36
Message-ID: 73cae1b4-75d0-4f55-b034-a1f9b7be61a2@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 18/05/2026 20:42, Andrei Lepikhov wrote:
> On 18/05/2026 00:43, Michael Paquier wrote:
> Ok. So let me just leave the idea of avoiding unnecessary cache lookups here.
Here is my benchmark results.

Test script:

DROP SEQUENCE IF EXISTS abc;
CREATE UNLOGGED SEQUENCE abc USING seqlocal;
-- Warm up
SELECT count(nextval('abc')) FROM generate_series(1, 1E6) \watch i=0 c=100
\timing on
\o result.txt
-- Benchmark
SELECT count(nextval('abc')) FROM generate_series(1, 1E6) \watch i=0 c=100

To identify thermal impact I averaged and compared results per 20 iterations in
a pack:

| Window | Baseline | v29 |
| ----------- | -------- | ------------ |
| iter 1-20 | 236.92 | 235.28 |
| iter 21-40 | 235.77 | 236.17 |
| iter 41-60 | 238.53 | 234.64 |
| iter 61-80 | 236.62 | 234.35 |
| iter 81-100 | 237.13 | 235.24 |

This test doesn't include insertion machinery itself, so no cold cache measures
or sequence lock contention.

pgbench results on the UNLOGGED table insertion shows the following:

| Test | Baseline | v29 | Δ |
| INSERT pgbench (mean tps) | 24,997 | 25,195 | +0.79% |

My oldish Intel-based MacBook is probably not sensitive enough to detect the
overhead. So, you can recheck the result using scripts [1] to restore the exact
test.

[1] https://github.com/danolivo/conf/tree/main/2026e-SeqAM

--
regards, Andrei Lepikhov,
pgEdge

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nisha Moond 2026-05-19 13:38:22 Re: Improve conflict detection when replication origins are reused
Previous Message Alexander Korotkov 2026-05-19 13:00:58 Re: Function scan FDW pushdown