Re: Useless sort by

Поиск
Список
Период
Сортировка
От Gaetano Mendola
Тема Re: Useless sort by
Дата
Msg-id AANLkTi=RqV1Q-zJW2+JP3PBaQb4mxPz9ZS9BL_fCsG3Y@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Useless sort by  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Useless sort by  (Maciek Sakrejda <msakrejda@truviso.com>)
Re: Useless sort by  (Scott Marlowe <scott.marlowe@gmail.com>)
Re: Useless sort by  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-performance
On Mon, Sep 13, 2010 at 6:48 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Gaetano Mendola <mendola@gmail.com> writes:
>> Of course I'm not suggesting to take away the "sort by" and give the user
>> an unsorted result, I'm asking why the the optimizer in cases like:
>
>>    select unique(a) from v_table_with_order_by;
>
>> doesn't takes away the "order by" inside the view and puts it back "rewriting the
>> query like this:
>
>>    select unique(a) from v_table_without_order_by
>>    order by a;
>
> That changes the order in which the rows are fed to unique(a).  The
> principal real-world use for a non-top-level ORDER BY is exactly to
> determine the order in which rows are fed to a function, so we will
> have a revolt on our hands if we break that.

I see your point, but some functions like:  unique, count are not affected
by the order of values fed, and I don't think either that unique has to
give out the unique values in the same fed order.


Regards
Gaetano Mendola

--
cpp-today.blogspot.com

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Useless sort by
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: Major performance problem after upgrade from 8.3 to 8.4