On 5/3/05, Tom Lane <[EMAIL PROTECTED]> wrote:
> Steven Rosenstein <[EMAIL PROTECTED]> 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
GPLS -- PINES Development
Database Developer

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?


Reply via email to