Re: Postgres batch write very slow - what to do - Mailing list pgsql-performance

From Heikki Linnakangas
Subject Re: Postgres batch write very slow - what to do
Date
Msg-id 45F685B7.5040001@enterprisedb.com
Whole thread Raw
In response to Postgres batch write very slow - what to do  (femski <hypertree@yahoo.com>)
Responses Re: Postgres batch write very slow - what to do  (femski <hypertree@yahoo.com>)
List pgsql-performance
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

pgsql-performance by date:

Previous
From: femski
Date:
Subject: Postgres batch write very slow - what to do
Next
From:
Date:
Subject: Re: Execution plan changed after upgrade from 7.3.9 to 8.2.3