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