Re: incomplete batch-updates

From: Kris Jurka <books(at)ejurka(dot)com>
To: Marcel Steinbach <steinbach(at)gmx(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: incomplete batch-updates
Date: 2007-07-15 15:42:33
Message-ID: Pine.BSO.4.64.0707151137420.11176@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Wed, 11 Jul 2007, Marcel Steinbach wrote:

> i'm having trouble with batches. When I run into an
> BatchUpdateException, the table is filled up to a multiple of 256
> records (guess, the batch seems to be executed in 256-steps), and, for
> example, if the Exception was thrown at the 300. statements, the
> tablesize is 256, and 44 are missing - but: The getUpdateCount() says,
> that all statements until the Exception (299) affacted "1" row.
>

While you have setAutoCommit true, the server is still running a
transaction around the JDBC driver's internal batch size of 256. So
the driver sends the first 256 statements and they go through fine
and get committed. Then it sends the next 44 and finds an error and rolls
it back. So if you really want each statement to be in its own
transaction you shouldn't use batch execution. There will be no
performance gain from using batch execution unless the server/driver can
actually batch something together.

Kris Jurka

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Eric Faulhaber 2007-07-15 17:34:30 Re: Implicit autocommit?
Previous Message Kris Jurka 2007-07-15 15:35:01 Re: getProcedureColumns