pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kris Jurka <books@ejurka.com>
Cc: Maciek Sakrejda <msakrejda@truviso.com>
Cc: Anish Kejariwal <anishkej@yahoo.com>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: avoid prepared statements on complex queries?
Date: Wed, 16 Nov 2011 19:35:52 -0500
Message-ID: <25036.1321490152@sss.pgh.pa.us> (raw)
In-Reply-To: <alpine.BSO.2.00.1111161614110.14447@leary.csoft.net>
References: <1321406281.74175.YahooMailNeo@web33903.mail.mud.yahoo.com>
	<CAH_hXRb6iGy7A0oUJ_DJipNqDG=JM54h4t+JH7awfH8NBAneSg@mail.gmail.com>
	<1321475873.74818.YahooMailNeo@web33905.mail.mud.yahoo.com>
	<CAH_hXRb2Z8Ln4_t0S=EbEL66yPf6uPx+=PPVswbr5uDa7NW45w@mail.gmail.com>
	<alpine.BSO.2.00.1111161614110.14447@leary.csoft.net>

Kris Jurka <books@ejurka.com> writes:
> On Wed, 16 Nov 2011, Maciek Sakrejda wrote:
>> Maybe, although I've never seen that happen and as I understand, the
>> driver always sends parameters along with the statement when using
>> unnamed statements, so I'm not sure what would trigger this.

> The standard example is "WHERE col LIKE ?".  If the parameter is something 
> like 'abcdef%' then the query can potentially be converted to a range 
> scan, but only if knows the parameter value.  When preparing this with an 
> unnamed statement the server has the parameter value, but cannot assume 
> that the same unnamed statement won't be used with a different parameter 
> value later and must come up with a plan that is correct for all possible 
> parameters even if it's not ideal for the current one.

BTW, this should be all better in 9.2 ... so if anyone is thinking of
expending lots of effort to fix it on the JDBC side, don't bother.

			regards, tom lane



view thread (9+ messages)  latest in thread

Message-ID: <25036.1321490152@sss.pgh.pa.us>
Permalink:  ../25036.1321490152@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/25036.1321490152@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, books@ejurka.com, msakrejda@truviso.com, anishkej@yahoo.com
  Subject: Re: avoid prepared statements on complex queries?
  In-Reply-To: <25036.1321490152@sss.pgh.pa.us>
  References: <1321406281.74175.YahooMailNeo@web33903.mail.mud.yahoo.com> <CAH_hXRb6iGy7A0oUJ_DJipNqDG=JM54h4t+JH7awfH8NBAneSg@mail.gmail.com> <1321475873.74818.YahooMailNeo@web33905.mail.mud.yahoo.com> <CAH_hXRb2Z8Ln4_t0S=EbEL66yPf6uPx+=PPVswbr5uDa7NW45w@mail.gmail.com> <alpine.BSO.2.00.1111161614110.14447@leary.csoft.net> <25036.1321490152@sss.pgh.pa.us>

* 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