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

From Zeugswetter Andreas DCP SD
Subject Re: Prepared statements considered harmful
Date
Msg-id E1539E0ED7043848906A8FF995BDA579014DBDAF@m0143.s-mxs.net
Whole thread Raw
In response to Re: Prepared statements considered harmful  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
> > How about "prepared" means really "prepared"... in the sense of
> > parsed, analyzed all sensible plans, and save a meta-plan which
based
> > on current statistics and parameter values chooses one of the
> > considered (and cached) plans ?
>
> I don't think this could solve one particularly frequent
> problem which is that pattern matching queries don't get
> along with prepared plans if the search pattern isn't known
> at planning time.

I think what we would actually want is knowledge about how
much difference different parameters actually make in plan decision.
(the stats show an even distribution and join correlation)
Then we could prepare the plan when there is not much difference
and postpone planning until we know the parameters when the difference
is big.

OLTP workload typically benefits from prepared plans, and the one plan
is good
for all possible inputs, so imho we cannot just assume all plans need
replanning
for different parameters.

Andreas


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Prepared statements considered harmful
Next
From: Peter Eisentraut
Date:
Subject: Re: Prepared statements considered harmful