Re: Prepared statements considered harmful - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Prepared statements considered harmful
Date
Msg-id 200608311549.22228.peter_e@gmx.net
Whole thread Raw
In response to Re: Prepared statements considered harmful  (Csaba Nagy <nagy@ecircle-ag.com>)
Responses Re: Prepared statements considered harmful
List pgsql-hackers
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/


pgsql-hackers by date:

Previous
From: stark
Date:
Subject: GUC settings with units broken?
Next
From: Csaba Nagy
Date:
Subject: Re: Prepared statements considered harmful