Re: Sequence's value can be rollback after a crashed recovery.

Nathan Bossart <bossartn@amazon.com>

From: "Bossart, Nathan" <bossartn@amazon.com>
To: Laurenz Albe <laurenz.albe@cybertec.at>, Andy Fan <zhihui.fan1213@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-11-22T19:50:42Z
Lists: pgsql-hackers
On 11/22/21, 5:10 AM, "Laurenz Albe" <laurenz.albe@cybertec.at> wrote:
> On Mon, 2021-11-22 at 15:43 +0800, Andy Fan wrote:
>> The performance argument was expected before this writing. If we look at the
>> nextval_interval more carefully, we can find it would not flush the xlog every
>> time even the sequence's cachesize is 1. Currently It happens every 32 times
>> on the nextval_internal at the worst case.
>
> Right, I didn't think of that.  Still, I'm -1 on this performance regression.

I periodically hear rumblings about this behavior as well.  At the
very least, it certainly ought to be documented if it isn't yet.  I
wouldn't mind trying my hand at that.  Perhaps we could also add a new
configuration parameter if users really want to take the performance
hit.

Nathan

Commits

  1. Doc: improve documentation about nextval()/setval().