Re: Speeding up Aggregates

Поиск
Список
Период
Сортировка
От Dror Matalon
Тема Re: Speeding up Aggregates
Дата
Msg-id 20031010035526.GT2979@rlx11.zapatec.com
обсуждение исходный текст
Ответ на Re: Speeding up Aggregates  (Bruno Wolff III <bruno@wolff.to>)
Ответы Re: Speeding up Aggregates  (Greg Stark <gsstark@mit.edu>)
Re: Speeding up Aggregates  (Josh Berkus <josh@agliodbs.com>)
Список pgsql-performance
On Thu, Oct 09, 2003 at 08:35:22PM -0500, Bruno Wolff III wrote:
> On Thu, Oct 09, 2003 at 17:44:46 -0700,
>   Dror Matalon <dror@zapatec.com> wrote:
> >
> > How is doing order by limit 1 faster than doing max()? Seems like the
> > optimizer will need to sort or scan the data set either way. That part
> > didn't actually make a difference in my specific case.
>
> max() will never be evaluated by using an index to find the greatest value.
> So in many cases using order by and limit 1 is faster.

Ouch. I just double checked and you're right. Is this considered a bug,
or just an implementation issue?

While I've seen this hint a few times in the lists, it seems like it's
one of those magic incantations that those in the know, know about, and
that people new to postgres are going to be surprised by the need to use
this idiom.

Regards,

Dror

--
Dror Matalon
Zapatec Inc
1700 MLK Way
Berkeley, CA 94709
http://www.zapatec.com

В списке pgsql-performance по дате отправления:

Предыдущее
От: Neil Conway
Дата:
Сообщение: Re: Sun performance - Major discovery!
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Sun performance - Major discovery!