Re: INSERT or COPY: Which one?

From: Bryan Irvine <bryan(dot)irvine(at)kingcountyjournal(dot)com>
To: Nabil Sayegh <postgresql(at)e-trolley(dot)de>
Cc: Colin Gillespie <C(dot)Gillespie(at)newcastle(dot)ac(dot)uk>, pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: INSERT or COPY: Which one?
Date: 2004-06-03 20:23:49
Message-ID: 1086294229.12812.15.camel@elvis2.horvitznewspapers.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I got this today and I don't know the if the list is behind or the
senders client, so I'll reply anyway.

I did some benchmark testing of copy vs insert, using a 3 million record
file with 1 table and 3 fields containing 10 numbers (between all
fields, they were phonenumbers to be precise). The insert took about 2
hours (this was last summer so my numbers might be slightly off) and the
copy took 45 seconds.

So use copy when appropriate.

--Bryan

On Tue, 2004-02-17 at 12:01, Nabil Sayegh wrote:
> Colin Gillespie wrote:
> > Dear All,
> >
> > I which to insert text (more than 1000 lines) into a single cell of my table, should I use COPY here or INSERT?
> >
> > My reading seems to suggest that you would use COPY for mulitple INSERTs, but when inserting alot of data into one cell, INSERT is fine. Is this correct?
>
> COPY is much faster, INSERT is safer.
> I heard that all issues regarding COPY are fixed (since 7.3?), but IIRC I still had some trouble
> with SERIALs and referential integrity.
>
> HTH

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Frank Bax 2004-06-03 20:31:34 Re: Executing sql script
Previous Message Joe Erickson 2004-06-03 19:47:39 Re: Executing sql script