Re: Stable sort?

Поиск
Список
Период
Сортировка
От redhog
Тема Re: Stable sort?
Дата
Msg-id 1162987834.839435.215040@i42g2000cwa.googlegroups.com
обсуждение исходный текст
Ответ на Re: Stable sort?  (Richard Huxton <dev@archonet.com>)
Ответы Re: Stable sort?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
> I don't see how it could be:
>    SELECT * FROM (SELECT * FROM a ORDER BY x DESC) AS B ORDER BY x ASC;

That is a rather different query. My question was if the order of two
elements whose internal order is not affected by the current ordering
clause, still may change places due to technicalities. That is, the
normal meaning of the term "stable sort" as it applies to sorting
algorithms.

Example:

Given a subquery that returns the rows

 a| b
<s>+</s>
 2|1
 2|2
 1|1
 1|2

and an order by a, will the result allways be

 a| b
<s>+</s>
 1|1
 1|2
 2|1
 2|2

or might it sometimes end up as e.g.

 a| b
<s>+</s>
 1|2
 1|1
 2|1
 2|2

?


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

Предыдущее
От: Alcides Guillermo Alarcón Rojas
Дата:
Сообщение: Salir de la lista
Следующее
От: "H.J. Sanders"
Дата:
Сообщение: Re: converting Informix outer to Postgres