Re: Postgres batch write very slow - what to do

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: femski <hypertree(at)yahoo(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Postgres batch write very slow - what to do
Date: 2007-03-13 11:06:31
Message-ID: 45F685B7.5040001@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message vincent.moreau 2007-03-13 11:11:54 Re: Execution plan changed after upgrade from 7.3.9 to 8.2.3
Previous Message femski 2007-03-13 10:55:12 Postgres batch write very slow - what to do