Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-jdbcpgsql-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

pgsql-performance by date

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

pgsql-jdbc by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group