Re: Optimizing prepared statements - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: Optimizing prepared statements
Date
Msg-id 877j0kwtws.fsf@enterprisedb.com
Whole thread Raw
In response to Re: Optimizing prepared statements  ("Jeroen T. Vermeulen" <jtv@xs4all.nl>)
Responses Re: Optimizing prepared statements  ("Jeroen T. Vermeulen" <jtv@xs4all.nl>)
List pgsql-hackers
"Jeroen T. Vermeulen" <jtv@xs4all.nl> writes:

> Oh, sorry--I guess I haven't been too systematic about it.  In the
> algorithm's current incarnation, ...

Thanks, that cleared things up enormously. I'm trying to figure how it would
react to some of the queries I've written in the past. In particular I'm
thinking of queries like

WHERE (? OR category = ?) AND (? OR cost < ?) AND (? OR description like ?||'%')

Where I then pass flags in from the application to indicate which search
constraints to apply. If it notices that most searches are for a particular
set of constraints it would be able to cache plans with the unused constraints
removed.

It would not however be able to notice that the last parameter never contains
a % and therefore can use an index scan.

I'm also wondering how this interacts with plan stability. Obviously the
direct effect is to throw out any chance of it. But in the long run they may
be two complementary sides of the same thing.

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Getting a move on for 8.2 beta
Next
From: Martijn van Oosterhout
Date:
Subject: Re: Getting a move on for 8.2 beta