Skip site navigation (1) Skip section navigation (2)

Re: BUG #5611: SQL Function STABLE promoting to VOLATILE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Brian Ceccarelli <bceccarelli(at)net32(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #5611: SQL Function STABLE promoting to VOLATILE
Date: 2010-08-11 21:12:55
Message-ID: 12044.1281561175@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> In theory, the optimization Brian wants is possible here, right?  I
> mean, you could replace the functional call with a Param, and pull the
> Param out and make it an InitPlan.  Seems like that would generally be
> a win, if you figure to loop more than once and the execution cost of
> the function is not too tiny.

Yeah, possibly.  It would probably be difficult for the planner to
figure out where the cutover point is to make that worthwhile, though;
the point where you'd need to make the transformation is long before we
have any rowcount estimates.

I was about to suggest that Brian could make that happen manually
by writing ... FROM srf((SELECT expensive_func())) ... but I think
actually that will just amount to another way of disabling inlining.

			regards, tom lane

In response to

Responses

pgsql-bugs by date

Next:From: Alvaro HerreraDate: 2010-08-11 21:25:11
Subject: Re: BUG #5611: SQL Function STABLE promoting to VOLATILE
Previous:From: Brian CeccarelliDate: 2010-08-11 20:47:50
Subject: Re: BUG #5611: SQL Function STABLE promoting to VOLATILE

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group