Re: MAX/MIN optimization via rewrite (plus query rewrites generally)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: MAX/MIN optimization via rewrite (plus query rewrites generally)
Дата
Msg-id 9858.1100197283@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: MAX/MIN optimization via rewrite (plus query rewrites generally)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Bruno Wolff III <bruno@wolff.to> writes:
>   Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> We know how to determine that an index matches an ORDER BY clause.
>> But what has an aggregate called MAX() got to do with ORDER BY?

> Wouldn't knowing an opclass and direction associated with an aggregrate
> function allow you to do this?

That's one way you could do it.  Another possibly cleaner way is to just
supply a sort operator (with the implication "the desired value is the
one ordered first by this operator") and then let the optimizer work out
which opclass(es) are relevant.  This would win if the same operator
appears in different opclasses, which is uncommon at the moment but
would not be so if we start offering "reverse sort" opclasses.

I think we covered all this ground before, though --- have you checked
the archives from the last time this was discussed?
        regards, tom lane


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

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: MAX/MIN optimization via rewrite (plus query
Следующее
От: Greg Stark
Дата:
Сообщение: Re: MAX/MIN optimization via rewrite (plus query rewrites generally)