Brian Hurt <bhurt@janestcapital.com> writes:
> Non-developer here, but we use a lot of plpgsql functions at work. And
> the functions we use fall into two broad, ill-defined catagories-
> "expensive" functions and "cheap" functions. What I'd like as a user is
> some way to tell the planner "this function is expensive- prefer plans
> which call this function less even if they're otherwise more expensive"
> or "this function is cheap, prefer plans that are otherwise less
> expensive even if they call this function more often". Precise cost
> estimates aren't that important, IMHO.
Right, so a plain constant cost would be plenty for your situation.
I suspect there's an 80/20 rule at work here --- the estimator-function
side of this will take most of the effort to design/implement, but not
get used nearly as much as the plain-constant form ... maybe we should
just do the constant for starters and see how many people really want to
write C-code estimators ...
regards, tom lane