Re: Increment a sequence by more than one

From: "Peter Childs" <peterachilds(at)gmail(dot)com>
To: "Michael Glaesemann" <grzm(at)seespotcode(dot)net>
Cc: "Erik Jones" <erik(at)myemma(dot)com>, "Steve Midgley" <public(at)misuse(dot)org>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Increment a sequence by more than one
Date: 2007-08-06 07:00:31
Message-ID: a2de01dd0708060000k504525bdt99177726bb7af529@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 03/08/07, Michael Glaesemann <grzm(at)seespotcode(dot)net> wrote:
>
>
> On Aug 3, 2007, at 15:27 , Erik Jones wrote:
>
> > Is there actually a requirement that the block of 5000 values not
> > have gaps?
>
> Good point.
>
> > If not, why not make the versioned table's id column default to
> > nextval from the same sequence?
>
> Of course, the ids of the two tables could be interleaved in this
> case. This might not be an issue, of course.
>
>
> Michael Glaesemann
> grzm seespotcode net
>
>
It seams to me that one should use the cache feature of a sequence is there
just for this purpose.

That way when you get the next value your session caches and any other
sessions will get one after your cache range.

Peter

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Kiran 2007-08-06 08:57:07 Best Fit SQL query statement
Previous Message Lew 2007-08-04 19:33:39 Re: Race condition in resetting a sequence