Re: Sequence skipping values

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
Cc: Jean-Christophe Roux <jcxxr(at)yahoo(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Sequence skipping values
Date: 2006-02-10 18:41:36
Message-ID: 20060210184136.GA2837@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Feb 10, 2006 at 09:57:31AM -0800, Steve Crawford wrote:
> There is no guarantee that a sequence will be contiguous. For example,
> begin...insert into...rollback will not reset the sequence as other
> transactions could have incremented the sequence.

Also, deleting records won't modify the sequence (unless a trigger
does so; the point is that the delete itself doesn't). If you
delete the latest records in the table, the sequence will continue
from where it was after the last insert (more properly, after the
last call to nextval), not from the new highest value in the table.

Other possibilities, though less likely, are that the sequence has
non-default CACHE or INCREMENT values.

--
Michael Fuhr

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tony Caduto 2006-02-10 19:42:45 Re: Tool
Previous Message Bob Pawley 2006-02-10 18:03:57 Re: Tool