Re: executeBatch() issue with new driver?

From: Alan Stange <stange(at)rentec(dot)com>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: executeBatch() issue with new driver?
Date: 2004-11-02 20:44:40
Message-ID: 4187F1B8.1010302@rentec.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Kris Jurka wrote:

>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.
>
>
What about this case:

Connection conn = ...
Statement st = conn.createStatement();
st.execute("insert a; insert b; insert c; insert d;");

Is the 8.0 driver busting this up into 4 trips to the database?!

-- Alan

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2004-11-02 20:55:23 Re: executeBatch() issue with new driver?
Previous Message Dave Cramer 2004-11-02 20:43:53 Re: 1300 to 3100 lines of code for XA support