Re: ORDER BY

Поиск
Список
Период
Сортировка
От mark@mark.mielke.cc
Тема Re: ORDER BY
Дата
Msg-id 20050725225438.GA20944@mark.mielke.cc
обсуждение исходный текст
Ответ на ORDER BY  ("Marc G. Fournier" <scrappy@postgresql.org>)
Список pgsql-hackers
On Mon, Jul 25, 2005 at 06:11:08PM -0300, Marc G. Fournier wrote:
> Just curious as to whether or not a warning or something should be issued 
> in a case like:
>   SELECT c.*
>     FROM company c, company_summary cs
>    WHERE c.id = cs.id
>      AND cs.detail = 'test'
> ORDER BY cs.fullname;

> Unless I'm missing something, the ORDER BY clause has no effect, but an 
> EXPLAIN shows it does take extra time, obviously ...

Why would it have no effect? If there is a one to many mapping between
fullname and id, and if the rows in c with the same fullname have
different rows in c.*, then it does matter.

For the casual observer, only seeing the output of the table, they would
see a consistent reporting order, but would be unable to derive how the
table rows were sorted. :-)

mark

-- 
mark@mielke.cc / markm@ncf.ca / markm@nortel.com     __________________________
.  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Neighbourhood Coder
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | 
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, Ontario, Canada
 One ring to rule them all, one ring to find them, one ring to bring them all                      and in the darkness
bindthem...
 
                          http://mark.mielke.cc/



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

Предыдущее
От: Tino Wildenhain
Дата:
Сообщение: Re: ORDER BY
Следующее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: [PATCHES] Patch to fix plpython on OS X