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

Re: Poor addBatch performance. Why dosn't it use copy ?

From: "Ido M(dot) Tamir" <tamir(at)imp(dot)univie(dot)ac(dot)at>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Poor addBatch performance. Why dosn't it use copy ?
Date: 2007-04-20 14:02:32
Message-ID: 200704201602.32397.tamir@imp.univie.ac.at (view raw or flat)
Thread:
Lists: pgsql-jdbc
On Friday 20 April 2007 13:39, femski wrote:
> Folks !
>

> "I actually went and looked at the JDBC api and realized 'addBatch' means
> to run multiple stmts at once, not batch
> inserting.  femski, your best bet is to lobby the JDBC folks to build
> support for 'copy' into the driver for faster bulk loads (or help out in
> that regard). "
>
> Based on other responses  I am convinced this is indeed the problem and I
> think its a pretty serious limitation.
>
> Why doesn't the Postgres JDBC driver use "copy" for faster bulk insert ?
> What is the best way to speedup
> do bulk insert at this time or in near future (I was to use standard JDBC
> API) ?

I would also love to have copy support (again) in the driver, but
did you actually test that it would speed up your inserts?
You could save your 4m rows into a txt file and then
something like

cat file.out | psql -d db -c "copy table from stdin delimiter '\t';"
and then you would know if copy would really speed your
inserts up.

best wishes
ido




In response to

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2007-04-20 15:05:23
Subject: Re: Poor addBatch performance. Why dosn't it use copy ?
Previous:From: Giuseppe SaccoDate: 2007-04-20 12:54:59
Subject: Re: Poor addBatch performance. Why dosn't it use copy ?

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