Re: generalizing the planner knobs - Mailing list pgsql-hackers

From Pollard, Mike
Subject Re: generalizing the planner knobs
Date
Msg-id 6418CC03D0FB1943A464E1FEFB3ED46B01B220FC@im01.cincom.com
Whole thread Raw
In response to generalizing the planner knobs  (Neil Conway <neilc@samurai.com>)
Responses Re: generalizing the planner knobs  (Simon Riggs <simon@2ndquadrant.com>)
List pgsql-hackers
Simon Riggs wrote
> ISTM we could do some of that with another GUC, lets call it
> prepare_once = on. The system default is to have a prepared statement
> bound to a plan on its first parameter bind. If we set this to "off",
> then the statement will replan each time we bind. This would give us
> both flexibility and predictability. (As ever, someone suggest a
better
> name?).
>

We call it deferred optimization.

Do you really stop at the first parameter?  What if it couldn't possibly
affect the plan (<col> like '%M%', or <col> is not involved in an
index)?  You can continue to plan up until the first parameter that can
affect the plan.  At that point, you save off the plan, and when you get
actual values (on the execute command), continue with the planning.  You
can do the same thing with correlated subqueries

Mike Pollard
SUPRA Server SQL Engineering and Support
Cincom Systems, Inc.



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Reducing relation locking overhead
Next
From: Andrew Dunstan
Date:
Subject: Re: [PATCHES] snprintf() argument reordering not working