On Tue, 2007-05-08 at 08:08 -0400, Marshall, Steve wrote:
> I think the optimization could work if you could exclude prepared
> statements. However, I looked at the planning code and found no clear
> way to distinguish between a statement being prepared for later
> execution, and a statement being planned only for immediate execution.
> As a result, I don't think stable functions can (or should) be
> expanded to help optimize queries using constraint exclusion.
I think it should be possible to tell the difference between planned and
immediate-execution queries. Anything coming thru exec_simple_query can
be tagged as immediate-execution, so should be allowed to make the
evaulation of stable functions in the planner as being accurate for the
rest of the statement execution also.
-- Simon Riggs EnterpriseDB http://www.enterprisedb.com