Re: Query preparation - Mailing list pgsql-jdbc

From Tom Lane
Subject Re: Query preparation
Date
Msg-id 18961.1239742344@sss.pgh.pa.us
Whole thread Raw
In response to Re: Query preparation  (John Lister <john.lister-ps@kickstone.com>)
Responses Re: Query preparation  (John Lister <john.lister-ps@kickstone.com>)
List pgsql-jdbc
John Lister <john.lister-ps@kickstone.com> 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

pgsql-jdbc by date:

Previous
From: John Lister
Date:
Subject: Re: Query preparation
Next
From: John Lister
Date:
Subject: Re: Query preparation