Re: bulk insert performance problem

From: Mark Stosberg <mark(at)summersault(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: bulk insert performance problem
Date: 2008-04-08 13:50:40
Message-ID: ftft7g$19r$2@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Christian Bourque wrote:
>
> Any idea? Is there any other improvements I could do?

Are you using the "COPY" syntax in the import script or individual
insert statements? Using COPY will always be *much* faster.

I believe COPY always appends to tables rather than replacing the
contents, you can combine this technique with the possibility of
splitting up the task into multiple copy statements, but that has never
been necessary in my case, switching from INSERTS to a COPY statement
always provided the huge performance improvement I needed.

It's easy to confuse "pg_dump -d" with "psql -d" ...it's too bad they
mean very different things.

For pg_dump, "-d" causes INSERT statements to be generated instead of a
COPY statement, and is has been a mistake I made in the past, because I
expected to work like "psql -d", where "-d" means "database name".

I suppose the safe thing to do is to avoid using "-d" altogether!

Mark

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Matthew 2008-04-08 14:00:13 Re: bulk insert performance problem
Previous Message Mark Stosberg 2008-04-08 13:45:07 Re: what worked: performance improvements for geo-spatial searching on FreeBSD