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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-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

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2007-12-10 02:39:40 Re: [HACKERS] BUG #3799: csvlog skips some logs
Previous Message Simon Riggs 2007-12-09 15:32:17 Re: BUG #3811: Getting multiple values from a sequence generator

Browse pgsql-hackers by date

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