Re: Cached Query Plans (was: global prepared statements) - Mailing list pgsql-hackers

From Csaba Nagy
Subject Re: Cached Query Plans (was: global prepared statements)
Date
Msg-id 1208162078.8259.259.camel@PCD12478
Whole thread Raw
In response to Re: Cached Query Plans (was: global prepared statements)  (PFC <lists@peufeu.com>)
Responses Re: Cached Query Plans (was: global prepared statements)
Re: Cached Query Plans (was: global prepared statements)
List pgsql-hackers
>     The hairiness is in the plan dependence (or independence) on parameter  
> values, ideally we only want to cache plans that would be good for all  
> parameter values, only the user knows that precisely. Although it could be  
> possible to examine the column histograms...

If cached plans would be implemented, the dependence on parameter values
could be solved too: use special "fork" nodes in the plan which execute
different sub-plans depending on special parameter values/ranges,
possibly looking up the stats at runtime, so that the plan is in a
compiled state with the "decision points" wired in.

This of course would mean a lot heavier planning and possibly a lot
bigger plans, but you could afford that if you cache the plan. You could
even have a special command to plan a query this way.

Cheers,
Csaba.




pgsql-hackers by date:

Previous
From: "Pavel Stehule"
Date:
Subject: proposal: Additional parameters for RAISE statement
Next
From: PFC
Date:
Subject: Re: Cached Query Plans (was: global prepared statements)