From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kevin Brown <kevin@sysexperts.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: COPY from question
Date: Tue, 03 Feb 2004 10:10:29 -0500
Message-ID: <17867.1075821029@sss.pgh.pa.us> (raw)
In-Reply-To: <20040203105746.GE2608@filer>
References: <1070584326.18838.235.camel@cletus.lyris.com>
<Pine.GSO.4.10.10402031143460.19878-100000@bruce.csse.monash.edu.au>
<20040203105746.GE2608@filer>
Kevin Brown <kevin@sysexperts.com> writes:
> Slavisa Garic wrote:
>> Using pg module in python I am trying to run the COPY command to populate
>> the large table. I am using this to replace the INSERT which takes about
>> few hours to add 70000 entries where copy takes minute and a half.
> That difference in speed seems quite large. Too large. Are you batching
> your INSERTs into transactions (you should be in order to get good
> performance)? Do you have a ton of indexes on the table? Does it have
> triggers on it or some other thing (if so then COPY may well wind up doing
> the wrong thing since the triggers won't fire for the rows it
> inserts)?
COPY *does* fire triggers, and has done so for quite a few releases.
My bet is that the issue is failing to batch individual INSERTs into
transactions. On a properly-set-up machine you can't get more than one
transaction commit per client per disk revolution, so the penalty for
trivial transactions like single inserts is pretty steep.
regards, tom lane
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: tgl@sss.pgh.pa.us, kevin@sysexperts.com, pgsql-hackers@postgresql.org
Subject: Re: COPY from question
In-Reply-To: <17867.1075821029@sss.pgh.pa.us>
* 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