X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 70E863A3C38 for ; Tue, 2 Nov 2004 20:44:44 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85044-10 for ; Tue, 2 Nov 2004 20:44:41 +0000 (GMT) Received: from wren.rentec.com (unknown [65.213.84.9]) by svr1.postgresql.org (Postfix) with ESMTP id 10A853A2B4A for ; Tue, 2 Nov 2004 20:44:42 +0000 (GMT) Received: from [172.26.132.145] (hoopoe.rentec.com [172.26.132.145]) by wren.rentec.com (8.12.9/8.12.1) with ESMTP id iA2KieDr025533; Tue, 2 Nov 2004 15:44:40 -0500 (EST) Message-ID: <4187F1B8.1010302@rentec.com> Date: Tue, 02 Nov 2004 15:44:40 -0500 From: Alan Stange Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Mozilla Thunderbird 0.8 (X11/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kris Jurka Cc: pgsql-jdbc@postgresql.org Subject: Re: executeBatch() issue with new driver? References: <4187B025.2090201@rentec.com> <4187DF2E.3030302@rentec.com> <4187EBA4.2040100@rentec.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/37 X-Sequence-Number: 11459 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