Re: batch inserts are "slow"

From: Tim Terlegård <tim(at)se(dot)linux(dot)org>
To: Christopher Petrilli <petrilli(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: batch inserts are "slow"
Date: 2005-05-03 17:44:08
Message-ID: Pine.LNX.4.44.0505031942180.8117-100000@naskur.se.linux.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

> > I'm converting an application to be using postgresql instead of oracle.
> > There seems to be only one issue left, batch inserts in postgresql seem
> > significant slower than in oracle. I have about 200 batch jobs, each
> > consisting of about 14 000 inserts. Each job takes 1.3 seconds in
> > postgresql and 0.25 seconds in oracle. With 200 jobs this means several
> > more minutes to complete the task. By fixing this I think the
> > application using postgresql over all would be faster than when using
> > oracle.
>
> Just as on Oracle you would use SQL*Loader for this application, you
> should use the COPY syntax for PostgreSQL. You will find it a lot
> faster. I have used it by building the input files and executing
> 'psql' with a COPY command, and also by using it with a subprocess,
> both are quite effective.

I tried this now. Now it's down to 0.45 seconds. It feels a bit hacky to
run /usr/bin/psql from java, but it sure works. Thanks for the hint!

Tim

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Jona 2005-05-03 17:56:44 Bad choice of query plan from PG 7.3.6 to PG 7.3.9 part 1b
Previous Message Jona 2005-05-03 17:41:37 Bad choice of query plan from PG 7.3.6 to PG 7.3.9 part 2