pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki@enterprisedb.com>
To: femski <hypertree@yahoo.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Postgres batch write very slow - what to do
Date: Tue, 13 Mar 2007 11:06:31 +0000
Message-ID: <45F685B7.5040001@enterprisedb.com> (raw)
In-Reply-To: <9452092.post@talk.nabble.com>
References: <9452092.post@talk.nabble.com>

femski wrote:
> I have a batch application that writes approx. 4 million rows into a narrow
> table. I am using JDBC addBatch/ExecuteBatch with auto commit turned off.
> Batch size is 100. So far I am seeing Postgres take roughly five times the
> time it takes to do this in the Oracle. 

The usual tricks are:
- Drop indexes before loading, and rebuild them afterwards.
- Disable foreign key references while loading
- Use COPY instead of JDBC

Is the loading I/O or CPU bound? How long does the load actually take?

Are you running the latest version of PostgreSQL and the JDBC driver?

Have you read the "Populating a Database" chapter in the manual: 
http://www.postgresql.org/docs/8.2/interactive/populate.html

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com



view thread (20+ messages)  latest in thread

Message-ID: <45F685B7.5040001@enterprisedb.com>
Permalink:  ../45F685B7.5040001@enterprisedb.com/
Also on:    postgresql.org/message-id/45F685B7.5040001@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: heikki@enterprisedb.com, hypertree@yahoo.com
  Subject: Re: Postgres batch write very slow - what to do
  In-Reply-To: <45F685B7.5040001@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox