pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
Cc: Oliver Jowett <oliver@opencloud.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: John Lister <john.lister-ps@kickstone.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Query preparation
Date: Mon, 20 Apr 2009 17:51:27 -0400 (EDT)
Message-ID: <Pine.BSO.4.64.0904201744220.12014@leary.csoft.net> (raw)
In-Reply-To: <49E71286.9020500@enterprisedb.com>
References: <49E4A6FA.7050407@kickstone.com>
	<49E4AEAC.5000700@opencloud.com>
	<49E4F20C.6040900@kickstone.com>
	<18961.1239742344@sss.pgh.pa.us>
	<49E4FBB0.40405@kickstone.com>
	<49E5D64F.8010603@enterprisedb.com>
	<49E5DD02.2060909@opencloud.com>
	<10718.1239808274@sss.pgh.pa.us>
	<49E71286.9020500@enterprisedb.com>



On Thu, 16 Apr 2009, Heikki Linnakangas wrote:

> Here's the patch. Describe message is only sent in the first invocation 
> of a query. The Field[] array constructed from the RowDescription 
> message is saved in the SimpleQuery object for reuse.
>

Applied with minor revisions.  When sending a Describe Statement message 
you'll also get a Row Description message back, so we need to add the 
query to the pendingDescribePortalQueue there as well.  Doing this always 
avoids some of the other special casing you tried to put in to handle 
describe statement (which didn't work if you see the new unit test I 
added).

While looking at this code it reminded me that we're also sending Describe 
Statement too often and I've fixed that to only do it when necessary. 
Previously the following code would describe the statement for every 
execution.

PreparedStatement ps = conn.prepareStatement("SELECT ?::int");
for (int i=0; i<100; i++) {
 	ps.setObject(1, new Integer(i), Types.OTHER);
 	ResultSet rs = ps.executeQuery();
}

Also the JDBC coding style guidelines require four space indentation 
rather than tabs, so you'll see some additional changes from that.

Kris Jurka



view thread (15+ messages)

Message-ID: <Pine.BSO.4.64.0904201744220.12014@leary.csoft.net>
Permalink:  ../Pine.BSO.4.64.0904201744220.12014@leary.csoft.net/
Also on:    postgresql.org/message-id/Pine.BSO.4.64.0904201744220.12014@leary.csoft.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: books@ejurka.com, heikki.linnakangas@enterprisedb.com, oliver@opencloud.com, tgl@sss.pgh.pa.us, john.lister-ps@kickstone.com
  Subject: Re: Query preparation
  In-Reply-To: <Pine.BSO.4.64.0904201744220.12014@leary.csoft.net>
  References: <49E4A6FA.7050407@kickstone.com> <49E4AEAC.5000700@opencloud.com> <49E4F20C.6040900@kickstone.com> <18961.1239742344@sss.pgh.pa.us> <49E4FBB0.40405@kickstone.com> <49E5D64F.8010603@enterprisedb.com> <49E5DD02.2060909@opencloud.com> <10718.1239808274@sss.pgh.pa.us> <49E71286.9020500@enterprisedb.com> <Pine.BSO.4.64.0904201744220.12014@leary.csoft.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox