Am Donnerstag, 31. August 2006 15:36 schrieb Csaba Nagy:
> On Thu, 2006-08-31 at 15:19, Peter Eisentraut wrote:
> > OK, why don't you work out an example. Let's look at this query:
> >
> > SELECT * FROM t1 WHERE a LIKE $1;
> >
> > What two plans would you prepare?
>
> if substring($1 from 1 for 1) != '%' then
> use plan 1 (see below);
> else
> use plan 2 (see below);
> end if;
Note that plan 1 can only be created if you know the actual value for $1.
--
Peter Eisentraut
http://developer.postgresql.org/~petere/