Avoiding evaluating functions twice.

From: han(dot)holl(at)informationslogik(dot)nl
To: pgsql-general(at)postgresql(dot)org
Subject: Avoiding evaluating functions twice.
Date: 2005-10-04 14:01:40
Message-ID: 200510041601.40805.han.holl@informationslogik.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Aaron Smith 2005-10-04 14:49:15 License question
Previous Message Jim C. Nasby 2005-10-04 13:51:45 Re: Maximum # of schemas