Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 33B3B6346DD for ; Tue, 14 Apr 2009 17:52:51 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 22635-08 for ; Tue, 14 Apr 2009 17:52:44 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 883646346D6 for ; Tue, 14 Apr 2009 17:52:48 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id n3EKqO8N018962; Tue, 14 Apr 2009 16:52:24 -0400 (EDT) To: John Lister cc: Oliver Jowett , pgsql-jdbc@postgresql.org Subject: Re: Query preparation In-reply-to: <49E4F20C.6040900@kickstone.com> References: <49E4A6FA.7050407@kickstone.com> <49E4AEAC.5000700@opencloud.com> <49E4F20C.6040900@kickstone.com> Comments: In-reply-to John Lister message dated "Tue, 14 Apr 2009 21:29:00 +0100" Date: Tue, 14 Apr 2009 16:52:24 -0400 Message-ID: <18961.1239742344@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.157 tagged_above=0 required=5 tests=AWL=0.157 X-Spam-Level: X-Archive-Number: 200904/53 X-Sequence-Number: 19500 John Lister writes: > Oliver Jowett wrote: >> It would be an extra network round-trip on every query, and there's no >> requirement to prepare it early. >> > Just going through the code again and please correct me if i'm wrong, > but at the moment there is unnecessary network traffic/latency. Assuming > a PreparedStatement, every time execute is called, sendParse and > sendDescribePortal are called (the former checks if a server side > prepared statement has been created and aborts if so). Admittedly > sendParse is only called as many times as setPrepareThreshold is set to > (which admittedly may be as low as 1) I think you're missing the cue that those are "send" operations. They don't wait for a response to come back. In fact, assuming that the JDBC driver is implemented the way I think, the actual data for both messages is expected to go out as a single network packet after the driver reaches the point of expecting a response. regards, tom lane