On Sat, Aug 6, 2011 at 7:29 PM, Dimitri Fontaine <dimitri@2ndquadrant.fr> wrote:
> Tom Lane <tgl@sss.pgh.pa.us> writes:
>> I think we'll be a lot better off with the framework discussed last
>> year: build a generic plan, as well as custom plans for the first few
>> sets of parameter values, and then observe whether there's a significant
>> reduction in estimated costs for the custom plans.
>
> Another way here would be to cache more than a single plan and to keep
> execution time samples or some other relevant runtime characteristics.
> Then what we need would be a way to switch from a plan to another at run
> time on some conditions, like realizing that the reason why the planner
> thought a nestloop would be perfect is obviously wrong, or maybe just
> based on runtime characteristics.
Tom and I discussed storing multiple sub-plans on a node back in '05
IIRC, and Tom later put in support for that.
That wasn't followed up on.
--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services