Re: Sequence gaps after restart

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christopher Sumner <christopher(dot)sumner(at)adimab(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Sequence gaps after restart
Date: 2021-05-11 16:15:59
Message-ID: 853211.1620749759@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Christopher Sumner <christopher(dot)sumner(at)adimab(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vijaykumar Jain 2021-05-11 17:12:01 Re: force partition pruning
Previous Message Rob Sargent 2021-05-11 16:07:56 Re: Sequence gaps after restart