Re: Optimize expresiions.

From: han(dot)holl(at)informationslogik(dot)nl
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Optimize expresiions.
Date: 2007-01-12 11:20:04
Message-ID: 200701121220.04640.han.holl@informationslogik.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thursday 11 January 2007 15:03, Adam Rich wrote:
> How about this?
>
> select item, very_expensive_function(item) as exp, cheap
> from ( Select item, cheap_function(item) as cheap
> From atable where cheap_function(item) > 0 ) sub
> where very_expensive_function(item) > 0
>
>
Well, there is nothing wrong with the much simpler
where cheap_function(item) > 0 and where very_expensive_function(item) > 0.

It's all about the order of evaluation.

Thanks,

Han Holl

In response to

Browse pgsql-general by date

  From Date Subject
Next Message km 2007-01-12 11:40:36 Re: PG compilation
Previous Message han.holl 2007-01-12 11:18:17 Re: Optimize expresiions.