Re: subselect, order by and left join

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: subselect, order by and left join
Дата
Msg-id 20041108045256.V86244@megazone.bigpanda.com
обсуждение исходный текст
Ответ на subselect, order by and left join  ("Morten K. Poulsen" <morten-postgresql@afdelingp.dk>)
Ответы Re: subselect, order by and left join  ("Morten K. Poulsen" <morten-postgresql@afdelingp.dk>)
Re: subselect, order by and left join  (Karim Nassar <Karim.Nassar@NAU.EDU>)
Список pgsql-general
On Mon, 8 Nov 2004, Morten K. Poulsen wrote:

> Please let me know if this is not the list to ask this kind of question.
>
> I am trying to optimize a query that joins two relatively large (750000 rows in
> each) tables. If I do it using a subselect, I can "force" the planner to choose
> the fastest path. Now, my question is:
>
> If I have a subselect with an ORDER BY, and I LEFT JOIN the result with the
> other table, is the order maintained? Or is PostgreSQL free to return the rows
> in any order, after the join?

AFAIK, you have no guarantees as to the output order unless you have
another order by.  The join may destroy the ordering, so even if you get
the ordering you want right now, you shouldn't rely on it.

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

Предыдущее
От: Masse Jacques
Дата:
Сообщение: Re: Visual DATA MODEL Designer in linux?
Следующее
От: "Morten K. Poulsen"
Дата:
Сообщение: Re: subselect, order by and left join