Re: [PERFORM] Stable function being evaluated more than once in a single query

2006-01-13 Thread Jim C. Nasby
Adding -docs... On Fri, Jan 13, 2006 at 07:27:28PM -0500, Tom Lane wrote: > "Jim C. Nasby" <[EMAIL PROTECTED]> writes: > > Is the issue that the optimizer won't combine two function calls (ie: > > SELECT foo(..) ... WHERE foo(..)), or is it that sometimes it won't make > > the optimization (maybe

Re: [PERFORM] Stable function being evaluated more than once in a single query

2006-01-13 Thread Tom Lane
"Jim C. Nasby" <[EMAIL PROTECTED]> writes: > Is the issue that the optimizer won't combine two function calls (ie: > SELECT foo(..) ... WHERE foo(..)), or is it that sometimes it won't make > the optimization (maybe depending on the query plan, for example)? What the STABLE category actually does

Re: [PERFORM] Stable function being evaluated more than once in a single query

2006-01-13 Thread Jim C. Nasby
On Wed, Jan 11, 2006 at 11:33:23PM -0500, Tom Lane wrote: > Mark Liberman <[EMAIL PROTECTED]> writes: > > I've got a set-returning function, defined as STABLE, that I reference > > twice > > within a single query, yet appears to be evaluated via two seperate > > function > > scans. > > There i

Re: [PERFORM] Stable function being evaluated more than once in a single query

2006-01-11 Thread Tom Lane
Mark Liberman <[EMAIL PROTECTED]> writes: > I've got a set-returning function, defined as STABLE, that I reference twice > within a single query, yet appears to be evaluated via two seperate function > scans. There is no guarantee, express or implied, that this won't be the case. (Seems like we

[PERFORM] Stable function being evaluated more than once in a single query

2006-01-11 Thread Mark Liberman
Hi, I've got a set-returning function, defined as STABLE, that I reference twice within a single query, yet appears to be evaluated via two seperate function scans. I created a simple query that calls the function below and joins the results to itself (Note: in case you wonder why I'd do suc