| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Kevin Brown <kevin(at)sysexperts(dot)com> |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: COPY from question |
| Date: | 2004-02-03 15:10:29 |
| Message-ID: | 17867.1075821029@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers pgsql-performance |
Kevin Brown <kevin(at)sysexperts(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2004-02-03 15:47:59 | Re: session IDs |
| Previous Message | Tom Lane | 2004-02-03 15:05:34 | Re: [pgsql-hackers-win32] Sync vs. fsync during checkpoint |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2004-02-03 15:27:22 | Re: PQexecParams and types |
| Previous Message | Czuczy Gergely | 2004-02-03 14:56:06 | Re: PQexecParams and types |