Re: Sequence gaps after restart - Mailing list pgsql-general

From Tom Lane
Subject Re: Sequence gaps after restart
Date
Msg-id 853211.1620749759@sss.pgh.pa.us
Whole thread Raw
In response to Sequence gaps after restart  (Christopher Sumner <christopher.sumner@adimab.com>)
List pgsql-general
Christopher Sumner <christopher.sumner@adimab.com> writes:
> I'm using PostgreSQL v. 10.14 via AWS Aurora Serverless.  Our users
> recently noticed gaps in the primary ids for many of our tables.  As I
> understand it, this is due to PostgreSQL effectively caching 32 additional
> sequence values (hardcoded in sequence.c ) and a 'restart' occurs.

Well, 32 is the worst case, but yes this is behaving as intended.

> Are there any plans to fix this issue

No.  If you must have gapless values, don't use sequences.

            regards, tom lane



pgsql-general by date:

Previous
From: Rob Sargent
Date:
Subject: Re: Sequence gaps after restart
Next
From: Vijaykumar Jain
Date:
Subject: Re: force partition pruning