Re: [GENERAL] Static functions

2008-10-06 Thread Joseph S
Martijn van Oosterhout wrote: On Sat, Oct 04, 2008 at 08:30:32PM -0400, Joseph S wrote: In this case, with the function being called over and over again inside a nested loop, it would be worth the effort. I'm not even talking about caching the result for the whole transaction block, just repla

Re: [GENERAL] Static functions

2008-10-05 Thread Martijn van Oosterhout
On Sat, Oct 04, 2008 at 08:30:32PM -0400, Joseph S wrote: > In this case, with the function being called over and over again inside > a nested loop, it would be worth the effort. I'm not even talking about > caching the result for the whole transaction block, just replacing the > function call

Re: [GENERAL] Static functions

2008-10-04 Thread Joseph S
Tom Lane wrote: "Gurjeet Singh" <[EMAIL PROTECTED]> writes: Shouldn't PG make all efforts to not execute something when the result is already known? Not if said effort would cost more than is saved, which would be by far the most likely result if we tried to cache all function results.

Re: [GENERAL] Static functions

2008-10-04 Thread Gurjeet Singh
On Sat, Oct 4, 2008 at 6:06 PM, Gregory Stark <[EMAIL PROTECTED]>wrote: > "Gurjeet Singh" <[EMAIL PROTECTED]> writes: > > > On Sat, Oct 4, 2008 at 8:49 AM, Tom Lane <[EMAIL PROTECTED]> wrote: > > > >> "Gurjeet Singh" <[EMAIL PROTECTED]> writes: > >> > Shouldn't PG make all efforts to not execute s

Re: [GENERAL] Static functions

2008-10-04 Thread Gregory Stark
"Gurjeet Singh" <[EMAIL PROTECTED]> writes: > On Sat, Oct 4, 2008 at 8:49 AM, Tom Lane <[EMAIL PROTECTED]> wrote: > >> "Gurjeet Singh" <[EMAIL PROTECTED]> writes: >> > Shouldn't PG make all efforts to not execute something when the result is >> > already known? >> >> Not if said effort would cost

Re: [GENERAL] Static functions

2008-10-03 Thread Gurjeet Singh
On Sat, Oct 4, 2008 at 8:49 AM, Tom Lane <[EMAIL PROTECTED]> wrote: > "Gurjeet Singh" <[EMAIL PROTECTED]> writes: > > Shouldn't PG make all efforts to not execute something when the result is > > already known? > > Not if said effort would cost more than is saved, which would be by far > the most

Re: [GENERAL] Static functions

2008-10-03 Thread Tom Lane
"Gurjeet Singh" <[EMAIL PROTECTED]> writes: > Shouldn't PG make all efforts to not execute something when the result is > already known? Not if said effort would cost more than is saved, which would be by far the most likely result if we tried to cache all function results.

Re: [GENERAL] Static functions

2008-10-03 Thread Gurjeet Singh
On Sat, Oct 4, 2008 at 1:36 AM, Tom Lane <[EMAIL PROTECTED]> wrote: > Joseph S <[EMAIL PROTECTED]> writes: > > Aren't static functions supposed to executed only once per transaction? > > There's no promise of that. > Can this be changed? Or does it work only in simpler queries, based on some resu

Re: [GENERAL] Static functions

2008-10-03 Thread Volkan YAZICI
On Fri, 03 Oct 2008, Joseph S <[EMAIL PROTECTED]> writes: > Aren't static functions supposed to executed only once per transaction? There is no such promise, that depends on the PL you prefer. For instance, in PL/scheme[1] non-volatile (immutable) and non-SRF functions are cached per (top) transac

Re: [GENERAL] Static functions

2008-10-03 Thread Tom Lane
Joseph S <[EMAIL PROTECTED]> writes: > Aren't static functions supposed to executed only once per transaction? There's no promise of that. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http:/

Re: [GENERAL] Static functions

2008-10-03 Thread Joseph Shraibman
Umm r/static/stable -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] Static functions

2008-10-03 Thread Joseph S
Aren't static functions supposed to executed only once per transaction? I have a query plan that looks like this: Unique (cost=441872.58..441875.39 rows=562 width=4) -> Sort (cost=441872.58..441873.98 rows=562 width=4) Sort Key: elog.uid -> Nested Loop (cost=89.52..441