Re: Sequence Access Methods, round two

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Andrei Lepikhov <lepihov(at)gmail(dot)com>
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-16 23:09:56
Message-ID: agj5RCIn0e62V1KA@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, May 15, 2026 at 11:04:37AM +0200, Andrei Lepikhov wrote:
> Here is a rebased version of the patch set.
> It is generally looks quite elegant. Of course, an int64 value seems a little
> restrictive, but in practice, with four different algorithms on board, I don't
> need a value larger than 64 bits at this moment.

Neither do I. Note that I have dropped this patch set from the commit
fest as I was/still-am not sure about its future, and there is a lack
of enthusiasm around it.

> Notes on the snowflake sequence (0007):
> 1. The gettimeofday() might be called out of the loop before the exclusive lock
> is acquired.
> 2. At least in my experience, gettimeofday does not always return monotonically
> increased values. So, it makes sense to save the used value inside the 'seq'
> structure and, if gettimeofday returned an earlier value, just increase this
> cached value a little.
> 3. Sleep call under the lock. It might not be so inevitable, and call it only
> when the time value stays the same.

That's the last patch of the series. This can be tweaked infinitely
with the right API infrastructure in place.

One thing that I have been pondering about is a worst-case scenario
with a benchmark that could show a performance impact due to the
function pointers:
- Mount PGDATA on a tmpfs.
- Disable fsync, etc.
- Create a table with a bunch of attributes, with one sequence
attached to each as default.
- COPY FROM to trigger a bunch of computations over all the attributes.
- Single backend, to avoid buffer lock interference.
- Disable WAL, trick the code to not WAL-logged, or use an in-memory
AM.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-05-16 23:11:55 Re: doc: fix pg_restore_extended_stats() example syntax
Previous Message Michael Paquier 2026-05-16 23:00:43 Re: Simplify signature of ProcessStartupPacket()