pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mike Rylander <mrylander@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Steven Rosenstein <srosenst@us.ibm.com>
Cc: pgsql-perform <pgsql-performance@postgresql.org>
Subject: Re:
Date: Wed, 4 May 2005 11:08:46 +0000
Message-ID: <b918cf3d05050404086f64a0d6@mail.gmail.com> (raw)
In-Reply-To: <21154.1115136741@sss.pgh.pa.us>
References: <OF93C70832.2AC188CE-ON85256FF6.0056B587-85256FF6.005774C2@us.ibm.com>
	<21154.1115136741@sss.pgh.pa.us>

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



view thread (20+ messages)  latest in thread

Message-ID: <b918cf3d05050404086f64a0d6@mail.gmail.com>
Permalink:  ../b918cf3d05050404086f64a0d6@mail.gmail.com/
Also on:    postgresql.org/message-id/b918cf3d05050404086f64a0d6@mail.gmail.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-performance@postgresql.org
  Cc: mrylander@gmail.com, tgl@sss.pgh.pa.us, srosenst@us.ibm.com
  Subject: Re:
  In-Reply-To: <b918cf3d05050404086f64a0d6@mail.gmail.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