Re: COPY versus INSERT

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: "Jay O'Connor" <joconnor(at)cybermesa(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: COPY versus INSERT
Date: 2003-05-14 15:27:17
Message-ID: Pine.LNX.4.33.0305140925210.30919-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 13 May 2003, Jay O'Connor wrote:

> I'm loading a database with a lot of data from an external source (I'm
> convertin all my data to postgresql)
>
> Right now I'm just connecting to the database and issuing a whole lot of
> INSERTS and this is taking longer than I had planned.
>
> Would it be faster to just dump my database ina tab delimited format and
> use a COPY FROM or psql /copy command?

Speed wise, here's my take on what's faster:

copy = X time.
insert 10,000 rows at a time in transactions: 2-10X time
insert all rows in autocommit, i.e. single transactions: (10^100)X

Of course, that last one is an exageration, but honestly, when you're
waiting on it, it feels that way. :-)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2003-05-14 15:30:52 Re: Schedule Jobs in Postgres
Previous Message Doug McNaught 2003-05-14 15:21:15 Re: COPY versus INSERT