Re: bulk insert performance problem

From: Matthew <matthew(at)flymine(dot)org>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: bulk insert performance problem
Date: 2008-04-08 14:00:13
Message-ID: Pine.LNX.4.64.0804081457200.20402@aragorn.flymine.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, 8 Apr 2008, Mark Stosberg 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.

PostgreSQL (latest versions at least) has an optimisation if you create a
table in the same transaction as you load data into it. So, if you have a
database dump, load it in using psql -1, which wraps the entire operation
in a single transaction. Of course, a COPY dump will load a lot faster
than a INSERT dump.

Matthew

--
What goes up must come down. Ask any system administrator.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Richard Huxton 2008-04-08 15:50:43 Re: Performance with temporary table
Previous Message Mark Stosberg 2008-04-08 13:50:40 Re: bulk insert performance problem