Re: executeBatch() issue with new driver? - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: executeBatch() issue with new driver?
Date
Msg-id Pine.BSO.4.56.0411021520580.17126@leary.csoft.net
Whole thread Raw
In response to Re: executeBatch() issue with new driver?  (Alan Stange <stange@rentec.com>)
Responses Re: executeBatch() issue with new driver?
List pgsql-jdbc

On Tue, 2 Nov 2004, Alan Stange wrote:

> >The real problem is that executeBatch() returns an int[] of update counts.
> >
> This was what I was thinking.   What does the pg74 driver do in this
> case as it does allow multiple statements in each batch?
>

The 8.0 driver uses the extended query protocol while the 7.4 driver
uses the simple query protocol.  The relevent difference in this case is
that you can only send one command per query in the extended query
protocol while you can string them together with ";" in the simple case.
This means the 8.0 driver splits the queries and issues them individually
and gets update counts for each command.  The 7.4 driver issues them
together and only gets one update count (for the last piece of the batch).

> Network latency.   We were able to greatly increase performance this way
> by reducing the number of round trips.
>

Well in the 8.0 case you've lost that anyway because it splits them and
issues them separately.  Although the 8.0 driver does have some other
advantages in that it doesn't issue a Sync after each individual query,
but sends out a number of commands and then processes a number of results,
so the number of round trips will be reduced, but in a different fashion.

Kris Jurka

pgsql-jdbc by date:

Previous
From: Vadim Nasardinov
Date:
Subject: Re: 1300 to 3100 lines of code for XA support
Next
From: Dave Cramer
Date:
Subject: Re: 1300 to 3100 lines of code for XA support