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
Re: subselect, order by and left join |
Список | 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 по дате отправления: