Re: MAX/MIN optimization via rewrite (plus query rewrites generally) - Mailing list pgsql-hackers

From Bruno Wolff III
Subject Re: MAX/MIN optimization via rewrite (plus query rewrites generally)
Date
Msg-id 20041111140001.GA16640@wolff.to
Whole thread Raw
In response to Re: MAX/MIN optimization via rewrite (plus query rewrites generally)  ("John Hansen" <john@geeknet.com.au>)
Responses Re: MAX/MIN optimization via rewrite (plus query rewrites generally)  ("Jim C. Nasby" <decibel@decibel.org>)
List pgsql-hackers
On Thu, Nov 11, 2004 at 17:52:19 +1100, John Hansen <john@geeknet.com.au> wrote:
> Why not just change the function all together to 'select $1 from $2
> order by $1 desc limit 1;'
> 
> Is there ANY situation where max(col) as it is, would be faster?

Yes. A couple I can think of are:
When count(col) is also being used.
When a GROUP BY is being used and there isn't an index that can both be used
to do the grouping and col order within each group.


pgsql-hackers by date:

Previous
From: "Zeugswetter Andreas DAZ SD"
Date:
Subject: Re: MAX/MIN optimization via rewrite (plus query rewrites generally)
Next
From: Greg Stark
Date:
Subject: Re: MAX/MIN optimization via rewrite (plus query