Re: avoid prepared statements on complex queries?

From: Kris Jurka <books(at)ejurka(dot)com>
To: Maciek Sakrejda <msakrejda(at)truviso(dot)com>
Cc: Anish Kejariwal <anishkej(at)yahoo(dot)com>, "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: avoid prepared statements on complex queries?
Date: 2011-11-16 21:16:59
Message-ID: alpine.BSO.2.00.1111161614110.14447@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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.

Kris Jurka

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2011-11-16 21:20:10 Re: avoid prepared statements on complex queries?
Previous Message Maciek Sakrejda 2011-11-16 21:01:39 Re: avoid prepared statements on complex queries?