Re: select max(column) not using index - Mailing list pgsql-hackers

From Stephan Szabo
Subject Re: select max(column) not using index
Date
Msg-id 20020313082734.W81426-100000@megazone23.bigpanda.com
Whole thread Raw
In response to select max(column) not using index  (Thomas Zehetbauer <thomasz@hostmaster.org>)
List pgsql-hackers
On Thu, 7 Mar 2002, Thomas Zehetbauer wrote:

> I think you all should really buy the book 'Database Development for Dummies'.
> Postgresql is for sure the only database on this planet that cannot optimize a
> select(max) using an index. Not even Microsoft has implemented such a design
> deficiency yet and even MySQL which you like to talk so bad about uses an
> index to optimize select max() queries. Some of you should really consider
> attending a programming course and all of you should consider to stop working
> on this totally screwed up monster!

I'm not sure why I'm bothering to respond, but...

Given that postgres allows user defined aggregates and I guess it'd be
possible for a user to redefine max into some form where the optimization
isn't valid (I'm not sure why mind you, but...) that'd mean that the
optimization is not always available.  Personally, I'd generally prefer
correct and slow over incorrect and fast. I'm fairly sure that if you made
a patch that cleanly dealt with the issue without programming in special
knowledge of min and max it'd be considered for inclusion.



pgsql-hackers by date:

Previous
From: "Luis Alberto Amigo Navarro"
Date:
Subject: again on bad performance
Next
From: mlw
Date:
Subject: Re: a vacuum thread is not the answer