Re:

From: Mike Rylander <mrylander(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Steven Rosenstein <srosenst(at)us(dot)ibm(dot)com>, pgsql-perform <pgsql-performance(at)postgresql(dot)org>
Subject: Re:
Date: 2005-05-04 11:08:46
Message-ID: b918cf3d05050404086f64a0d6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 5/3/05, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Steven Rosenstein <srosenst(at)us(dot)ibm(dot)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(at)gmail(dot)com
GPLS -- PINES Development
Database Developer
http://open-ils.org

In response to

  • Re: at 2005-05-03 16:12:21 from Tom Lane

Browse pgsql-performance by date

  From Date Subject
Next Message Mike G. 2005-05-04 14:58:25 Table stats
Previous Message Mark Kirkwood 2005-05-04 05:16:36 Re: Kernel Resources and max_connections