From: | Peter Crabtree <peter(dot)crabtree(at)gmail(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | depesz(at)depesz(dot)com, Kenneth Marshall <ktm(at)rice(dot)edu>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Generating Lots of PKs with nextval(): A Feature Proposal |
Date: | 2010-05-14 21:58:59 |
Message-ID: | AANLkTikIAWCf2sbSqUvj-TDPN9bTRbux0Ortw_m1PZwL@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, May 14, 2010 at 5:29 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Fri, May 14, 2010 at 5:04 PM, hubert depesz lubaczewski
> <depesz(at)depesz(dot)com> wrote:
>> On Fri, May 14, 2010 at 02:07:27PM -0500, Kenneth Marshall wrote:
>>> Hi Peter,
>>>
>>> All you need to do is define your own sequence with an
>>> increment of 500. Look at:
>>>
>>> http://www.postgresql.org/docs/8.4/static/sql-createsequence.html
>>
>> This is often not enough. For example - I want standard increment of 1,
>> but right now I'm importing 10000 objects, and it would be simpler for
>> me to get 10000 ids. Preferably in one block.
>>
>> This is not achievable now. I know I can 'alter sequence set increment
>> by' - but this will also affect concurrent sessions. which might not be
>> a problem, but it's a side effect that I don't want.
>>
>> +1 for original proposition, would love to get it.
>
> If we do this, I'm inclined to think that the extra argument to
> nextval() should be treated as overriding the base increment rather
> than specifying a multiplier for it. Other than that nitpick, it
> sounds like a reasonable thing to allow.
>
After giving it some thought, that sounds better. You gain some
functionality that way (temporarily overriding the interval) and lose
none.
Peter
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2010-05-14 22:11:27 | Re: Generating Lots of PKs with nextval(): A Feature Proposal |
Previous Message | Peter Crabtree | 2010-05-14 21:52:02 | Re: Generating Lots of PKs with nextval(): A Feature Proposal |