Re: Get block of N numbers from sequence

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Thomas Guettler <hv(at)tbz-pariv(dot)de>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Get block of N numbers from sequence
Date: 2009-05-19 15:57:46
Message-ID: 20090519155746.GB17055@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, May 19, 2009 at 03:32:16PM +0200, Thomas Guettler wrote:
> If other processes run nextval() between "increment by 1000" and "increment by 1",
> they leave big holes in the sequence.

yes. I know. there is no other way.

if you want 1000 ids, but they don't have to be consequtive, you can
simply:
select nextval('qq') from generate_series(1,1000);

depesz

--
Linkedin: http://www.linkedin.com/in/depesz / blog: http://www.depesz.com/
jid/gtalk: depesz(at)depesz(dot)com / aim:depeszhdl / skype:depesz_hdl / gg:6749007

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sebastien FLAESCH 2009-05-19 16:27:33 Re: INTERVAL data type and libpq - what format?
Previous Message Alvaro Herrera 2009-05-19 15:35:52 Re: array/function question