Re: Static functions - Mailing list pgsql-general

From Joseph S
Subject Re: Static functions
Date
Msg-id gc91qp$2d24$1@news.hub.org
Whole thread Raw
In response to Re: Static functions  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Static functions  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
Tom Lane wrote:
> "Gurjeet Singh" <singh.gurjeet@gmail.com> 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.
>
>             regards, tom lane
>
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 before continuing the query.

Perhaps I can get around this problem by creating a temp table inside
the function that is dropped on transaction commit.

pgsql-general by date:

Previous
From: "Richard Broersma"
Date:
Subject: PG Windows Installer Feature Request
Next
From: Bruce Momjian
Date:
Subject: Re: db_user_namespace, md5 and changing passwords