> On 15 Jan 2018, at 08:36, David G. Johnston <david.g.johnston@gmail.com> wrote:
>
> On Sunday, January 14, 2018, PG Bug reporting form <noreply@postgresql.org <mailto:noreply@postgresql.org>> wrote:
> The following bug has been logged on the website:
>
> Bug reference: 15010
> Logged by: Anil Kumar G V
> Email address: anilkumar.gv@gmail.com <mailto:anilkumar.gv@gmail.com>
> PostgreSQL version: 9.3.0
> Operating system: Ubuntu
> Description:
>
> Sometime sequence ID is getting skipped by 32 numbers. Here is some sample
> sequence definition.
>
> I don't think the exact cause of this particular skipping is documented (it's database startup, maybe crash, related
Ithink) but sequences are not promised to be gap-less.
Sequences are indeed not guaranteed to be gapless, and given that the report is
for 32 numbers it sounds like the SEQ_LOG_VALS skipping. From sequence.c:
/*
* We don't want to log each fetching of a value from a sequence,
* so we pre-log a few fetches in advance. In the event of
* crash we can lose (skip over) as many values as we pre-logged.
*/
#define SEQ_LOG_VALS 32
cheers ./daniel