Skip site navigation (1) Skip section navigation (2)

Re: BUG #3811: Getting multiple values from a sequence generator

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Michael Glaesemann" <grzm(at)seespotcode(dot)net>
Cc: "Adriaan van Os" <postgres(at)microbizz(dot)nl>, <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #3811: Getting multiple values from a sequence generator
Date: 2007-12-10 01:12:21
Message-ID: 87wsrnmjyi.fsf@oxford.xeocode.com (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-hackers
"Michael Glaesemann" <grzm(at)seespotcode(dot)net> writes:

> On Dec 9, 2007, at 9:24 , Adriaan van Os wrote:
>
>> 3. nextval doesn't have an optional "increase" parameter (the  increase is
>> always one).
>
> Not true. Please read the documentation at
>
> http://www.postgresql.org/docs/8.2/static/sql-createsequence.html
> http://www.postgresql.org/docs/8.2/static/sql-altersequence.html
>
> In particular, the INCREMENT BY option (and perhaps CACHE).

I think he's looking for a an option to increase a sequence which normally
increments by 1 by a larger number for a single transaction. You would want to
do this if you were doing an exceptional bulk operation. If you set the
"increment by" then if another transaction happens to come along while you've
modified it you'll waste N sequence numbers.

Seems like a reasonable feature request. But I do wonder if the OP has
actually tried just incrementing it one by one for each of the records being
inserted. Incrementing sequences is pretty damn quick and I doubt it would
actually be a bottleneck.

-- 
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com
  Ask me about EnterpriseDB's PostGIS support!

In response to

Responses

pgsql-hackers by date

Next:From: Alvaro HerreraDate: 2007-12-10 01:48:39
Subject: Re: [HACKERS] "distributed checkpoint"
Previous:From: Tom LaneDate: 2007-12-10 00:46:29
Subject: Re: whats the deal with -u ?

pgsql-bugs by date

Next:From: Alvaro HerreraDate: 2007-12-10 02:39:40
Subject: Re: [HACKERS] BUG #3799: csvlog skips some logs
Previous:From: Simon RiggsDate: 2007-12-09 15:32:17
Subject: Re: BUG #3811: Getting multiple values from a sequencegenerator

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group