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

From: Jeremy Schneider <schneider(at)ardentperf(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Bossart, Nathan" <bossartn(at)amazon(dot)com>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Sequence's value can be rollback after a crashed recovery.
Date: 2021-11-22 20:42:12
Message-ID: 68420495-2580-efc6-e930-5f14c55caae9@ardentperf.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/22/21 12:31, Tom Lane wrote:
> "Bossart, Nathan" <bossartn(at)amazon(dot)com> writes:
>> 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.
>
> A sequence's cache length is already configurable, no?
>

Cache length isn't related to the problem here.

The problem is that PostgreSQL sequences are entirely unsafe to use from
a durability perspective, unless there's DML in the same transaction.

Users might normally think that "commit" makes things durable.
Unfortunately, IIUC, that's not true for sequences in PostgreSQL.

-Jeremy

PS. my bad on the documentation thing... I just noticed that I said a
year ago I'd take a swing at a doc update, and I never did that!!
Between Nate and I we'll get something proposed.

--
http://about.me/jeremy_schneider

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2021-11-22 21:50:48 Reduce function call costs on ELF platforms
Previous Message Tom Lane 2021-11-22 20:31:19 Re: Sequence's value can be rollback after a crashed recovery.