Re: executeBatch() issue with new driver?

From: Kris Jurka <books(at)ejurka(dot)com>
To: Alan Stange <stange(at)rentec(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: executeBatch() issue with new driver?
Date: 2004-11-02 20:29:01
Message-ID: Pine.BSO.4.56.0411021520580.17126@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Vadim Nasardinov 2004-11-02 20:31:00 Re: 1300 to 3100 lines of code for XA support
Previous Message Alan Stange 2004-11-02 20:18:44 Re: executeBatch() issue with new driver?