From: | Hannu Krosing <hannu(at)tm(dot)ee> |
---|---|
To: | Thomas Zehetbauer <thomasz(at)hostmaster(dot)org> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: select max(column) not using index |
Date: | 2002-03-13 16:14:49 |
Message-ID: | 1016036094.30674.8.camel@taru.tm.ee |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, 2002-03-07 at 18:04, 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.
PostgreSQL is extensible enough that luser can define max() to mean
anything and thus you don't have a general way to optimise it without
breaking some cases.
If you know that max(x) means the biggest x there is and you have a
b-tree index on x you can use:
select x from t order by x desc limit 1;
> Not even Microsoft has implemented such a design deficiency yet and
It would be a very microsofty way to optimise in ways that sometimes
produce wrong results ;)
> even MySQL which you like to talk so bad about uses an
> index to optimize select max() queries.
What do you need the superfast max() for ?
If you are trying to re-implement sequences you may yet find some
surprises.
> 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!
Did you make yourself look bad by assuming that postgreSQL _does_ your
suggested optimisation ?
> Nirvana: Zustand des Gluecks durch Ausloeschung des Selbst.
How is this related to above ??
-------------
Hannu
From | Date | Subject | |
---|---|---|---|
Next Message | Darren King | 2002-03-13 16:15:11 | Re: select max(column) not using index |
Previous Message | Luis Alberto Amigo Navarro | 2002-03-13 16:10:26 | Re: bad performance on irix |