pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jason Earl <jason.earl@simplot.com>
To: Bryan White <bryan@arcamax.com>
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: How to best grab a chunk of Ids from a sequence
Date: 15 Nov 2001 12:05:19 -0700
Message-ID: <873d3fvor4.fsf@npa01zz001.simplot.com> (raw)
In-Reply-To: <00a801c16df3$e06d6230$2ed260d1@bryan>
References: <00a801c16df3$e06d6230$2ed260d1@bryan>


What you could do is use the setval() function to set the value of the
sequence to whatever it is now + 4 million.  That would give you a
great big hole in your sequence from which you could draw sequence
values from.  Your processes that still needed to use the sequence
would still be able to, and the information that you are importing
could use the sequence numbers that you skipped.

Jason

"Bryan White" <bryan@arcamax.com> writes:

> I have a process that will be creating a large number of records (about
> 4Million).  I am thinking of making this process run quicker by writing the
> records to a file in 'dump' format and then running that file through psql.
> 
> The problem is each record has a sequence number and I need to know the
> sequence ids for other
> purposes in this process.
> 
> My question is is there a way to grab 4 million IDs from a sequence without
> calling nextval once for each ID.  Note, this sequence is being actively
> drawn on by other processes.
> 
> ---------
> Bryan White
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org



view thread (3+ messages)

Message-ID: <873d3fvor4.fsf@npa01zz001.simplot.com>
Permalink:  ../873d3fvor4.fsf@npa01zz001.simplot.com/
Also on:    postgresql.org/message-id/873d3fvor4.fsf@npa01zz001.simplot.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jason.earl@simplot.com, bryan@arcamax.com
  Subject: Re: How to best grab a chunk of Ids from a sequence
  In-Reply-To: <873d3fvor4.fsf@npa01zz001.simplot.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox