Re: [BUGS] Function is called multiple times in subselect

2004-03-12 Thread Alex J. Avriette
On Fri, Mar 12, 2004 at 09:41:39AM -0500, Tom Lane wrote: > > And if you are concerned about the query's cost vs its actual output > > (you weren't clear in your original message), there is the 'iscachable' > > pragma for functions. > One of the reasons we renamed that pragma to "immutable" is th

Re: [BUGS] Function is called multiple times in subselect

2004-03-12 Thread Tom Lane
Chris Campbell <[EMAIL PROTECTED]> writes: > Or is there a way to advise the optimizer of the cost of my function, so > that it will choose to not flatten the subquery (since the total cost of > doing that will be higher)? Not at present. AFAIR, we have removed all traces of Joe Hellerstein's t

Re: [BUGS] Function is called multiple times in subselect

2004-03-12 Thread Chris Campbell
Alex J. Avriette wrote: And if you are concerned about the query's cost vs its actual output (you weren't clear in your original message), there is the 'iscachable' pragma for functions. I was concerned that my function was being called 4 times for each row of the result. The cost of the function

Re: [BUGS] Function is called multiple times in subselect

2004-03-12 Thread Tom Lane
"Alex J. Avriette" <[EMAIL PROTECTED]> writes: > And if you are concerned about the query's cost vs its actual output > (you weren't clear in your original message), there is the 'iscachable' > pragma for functions. I think that's unrelated to Chris' problem. One of the reasons we renamed that pr

Re: [BUGS] Function is called multiple times in subselect

2004-03-12 Thread Alex J. Avriette
On Thu, Mar 11, 2004 at 11:02:21PM -0500, Tom Lane wrote: > Chris Campbell <[EMAIL PROTECTED]> writes: > > I don't think this should be happening (PostgreSQL 7.4.1). > > Sorry, this isn't a bug. Flattening the subquery is generally desirable > behavior. And if you are concerned about the query's