Re: subselect, order by and left join

From: "Morten K(dot) Poulsen" <morten-postgresql(at)afdelingp(dot)dk>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: subselect, order by and left join
Date: 2004-11-08 14:58:37
Message-ID: 20041108145837.GC8216@mopo.i.tv2.dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Nov 08, 2004 at 04:54:40AM -0800, Stephan Szabo wrote:
> > 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.

OK. Thanks for the reply.

Morten

--
Morten K. Poulsen <morten-postgresql(at)afdelingp(dot)dk>
http://www.afdelingp.dk/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pallav Kalva 2004-11-08 15:01:04 Installing pgbench
Previous Message Stephan Szabo 2004-11-08 12:54:40 Re: subselect, order by and left join