Re: bulk insert performance problem - Mailing list pgsql-performance

From Mark Stosberg
Subject Re: bulk insert performance problem
Date
Msg-id ftft7g$19r$2@ger.gmane.org
Whole thread Raw
In response to bulk insert performance problem  ("Christian Bourque" <christian.bourque@gmail.com>)
Responses Re: bulk insert performance problem
List 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

pgsql-performance by date:

Previous
From: Mark Stosberg
Date:
Subject: Re: what worked: performance improvements for geo-spatial searching on FreeBSD
Next
From: Matthew
Date:
Subject: Re: bulk insert performance problem