From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> |
Cc: | David Roussel <pgsql-performance(at)diroussel(dot)xsmail(dot)com>, Mischa Sandberg <mischa(dot)sandberg(at)telus(dot)net>, pgsql-perform <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: COPY vs INSERT |
Date: | 2005-05-05 02:22:56 |
Message-ID: | 16747.1115259776@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> writes:
>> So what's the difference between a COPY and a batch of INSERT
>> statements. Also, surely, fsyncs only occur at the end of a
>> transaction, no need to fsync before a commit has been issued, right?
> With COPY, the data being inserted itself does not have to pass through
> the postgresql parser.
Also, there is a whole lot of one-time-per-statement overhead that can
be amortized across many rows instead of only one. Stuff like opening
the target table, looking up the per-column I/O conversion functions,
identifying trigger functions if any, yadda yadda. It's not *that*
expensive, but compared to an operation as small as inserting a single
row, it's significant.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Mischa Sandberg | 2005-05-05 04:41:46 | Re: COPY vs INSERT |
Previous Message | Christopher Kings-Lynne | 2005-05-05 01:51:22 | Re: COPY vs INSERT |