Re: Avoiding evaluating functions twice.

From: han(dot)holl(at)informationslogik(dot)nl
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Avoiding evaluating functions twice.
Date: 2005-10-04 19:11:50
Message-ID: 200510042111.50815.han.holl@informationslogik.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tuesday 04 October 2005 17:25, Tom Lane wrote:
> han(dot)holl(at)informationslogik(dot)nl writes:
> > 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) ?
>
> You can do something like this:
>
> select f from
> (select expensive_function(table) as f from table offset 0) ss
> where f is not null;
>
Thanks.

I think I can safely say I wouldn't have invented this magic in a year.

Cheers

Han Holl

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Arthur Hoogervorst 2005-10-04 19:16:20 Re: License question
Previous Message Arthur Hoogervorst 2005-10-04 19:10:50 Re: License question