Re: advancing sequences

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Dmitri Bichko <dbichko(at)genpathpharma(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: advancing sequences
Date: 2003-05-06 17:27:36
Message-ID: 20030506172736.GB21510@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, May 06, 2003 at 12:13:44 -0400,
Dmitri Bichko <dbichko(at)genpathpharma(dot)com> wrote:
> I am trying to speed up a couple of decent sized inserts (~25K rows a
> pop) by using COPY FROM.
> A slight snag I am running into is that the table I insert into has a
> primary key generated from a sequence.
> So I want to include this id in the temp text file that I copy from, so
> what is the proper way to grab 25K or so values from a sequence, without
> breaking anything?

If you don't include some columns in the copy they get the default. (I think
this might require 7.3 to do.) So if the table has a default that uses
nextval (as you would get using serial) then you should be able to just
leave the column off when doing the copy.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2003-05-06 17:42:40 Re: Database server restarting
Previous Message scott.marlowe 2003-05-06 16:38:06 Re: Database server restarting