Re: - Mailing list pgsql-performance

From Mike Rylander
Subject Re:
Date
Msg-id b918cf3d05050404086f64a0d6@mail.gmail.com
Whole thread Raw
In response to Re:  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
On 5/3/05, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Steven Rosenstein <srosenst@us.ibm.com> writes:
> > My question is, are there any advantages, drawbacks, or outright
> > restrictions to using multiple simultaneous COPY commands to load data into
> > the same table?
>
> It will work; not sure about whether there is any performance benefit.
> I vaguely recall someone having posted about doing this, so you might
> check the archives.
>

I may be one of Tom's vague "voices". ;)  The only issue would be that
you need to remove all you UNIQUE constraints before sending multiple
COPYs to the server.  This includes the PRIMARY KEY constraint.  To
the backend, COPY is just like INSERT and all constraints need to be
checked and this will block the commit of one of the COPY streams.

However, multiple COPYs may no be needed.  I regularly load several
table totaling around 50M rows with a single COPY per table.  I drop
(actually, this is during DB reload, so I don't yet create...) all
fkeys, constraints and indexes and the data loads in a matter of 5
minutes or so.

Hope that helps!

--
Mike Rylander
mrylander@gmail.com
GPLS -- PINES Development
Database Developer
http://open-ils.org

pgsql-performance by date:

Previous
From: Mark Kirkwood
Date:
Subject: Re: Kernel Resources and max_connections
Next
From: "Mike G."
Date:
Subject: Table stats