Using a COPY...FROM through JDBC?

From: Steve Wampler <swampler(at)noao(dot)edu>
To: Postgres-JDBC <pgsql-jdbc(at)postgresql(dot)org>, Postgres-performance <pgsql-performance(at)postgresql(dot)org>
Subject: Using a COPY...FROM through JDBC?
Date: 2004-06-05 20:12:29
Message-ID: 1086466349.29063.76.camel@weaver.tuc.noao.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc pgsql-performance


I've got a simple database (no indices, 6 columns) that I need
to write data quickly into through JDBC connections from
multiple such connections simultaneously in a distributed
environment. (This is going to be a message logging service
for software generated messages.)

Using a PreparedStatement, I can get about 400/s inserted. If I
(on the java side) buffer up the entries and dump them in large
transaction blocks I can push this up to about 1200/s. I'd
like to go faster. One approach that I think might be
promising would be to try using a COPY command instead of
an INSERT, but I don't have a file for input, I have a
Java collection, so COPY isn't quite right. Is there anyway to
efficiently use COPY without having to create a file (remember
that the java apps are distributed on a LAN and aren't running
on the DB server.) Is this a dead end because of the way
COPY is implemented to only use a file?

Is there something else I can do? Ultimately, this will end
up on a machine running 1+0 RAID, so I expect that will give
me some performance boost as well, but I'd like to push it
up as best I can with my current hardware setup.

Thanks for any advice!
-Steve
--
Steve Wampler -- swampler(at)noao(dot)edu
The gods that smiled on your birth are now laughing out loud.

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Brian G. Huber 2004-06-06 05:34:51 Forcing use of cursor for large result sets
Previous Message Oliver Jowett 2004-06-05 09:30:33 Re: How to insert binary data

Browse pgsql-performance by date

  From Date Subject
Next Message Harald Fuchs 2004-06-05 20:54:31 Re: Slow in morning hours
Previous Message Laurent Martelli 2004-06-05 19:01:29 Re: Unused table of view