Avoiding evaluating functions twice. - Mailing list pgsql-general

From han.holl@informationslogik.nl
Subject Avoiding evaluating functions twice.
Date
Msg-id 200510041601.40805.han.holl@informationslogik.nl
Whole thread Raw
Responses Re: Avoiding evaluating functions twice.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hello,

I've got the following situation:

select expensive_function(table) from table
                     where expensive_function(table) is not null;

Is there a way to avoid that expensive_function is evaluated twice (if it's
not null) ?
I've tried stuff like immutable, but that doesn't do anything for me.
Of course I can do a select into, but my guess is it would be even more
expensive than evaluating these functions twice.

Thanks in advance,

Han Holl



pgsql-general by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: Maximum # of schemas
Next
From: "ctobini"
Date:
Subject: export a select result in a file ?