Re: Question on PostgreSQL DB behavior w.r.t JOIN and sort order.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Venkatesan, Sekhar" <sekhar(dot)venkatesan(at)emc(dot)com>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Question on PostgreSQL DB behavior w.r.t JOIN and sort order.
Date: 2016-02-09 05:00:09
Message-ID: 21082.1454994009@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Venkatesan, Sekhar" <sekhar(dot)venkatesan(at)emc(dot)com> writes:
> I am seeing this behavior change in postgreSQL DB when compared to SQL Server DB when JOIN is performed. The sort order is not retained when JOIN is performed in PostgreSQL DB.

What sort order? You did not specify any ORDER BY clause, so the DBMS is
entitled to return rows in any order it feels like.

I do not know anything about this "top 10" modifier you've got in the
SQL Server version, but I suspect it's implying a sort order. In
Postgres, if you want a specific row ordering, you need to say ORDER BY.

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Venkatesan, Sekhar 2016-02-09 05:21:45 Re: Question on PostgreSQL DB behavior w.r.t JOIN and sort order.
Previous Message Venkatesan, Sekhar 2016-02-09 04:29:15 Question on PostgreSQL DB behavior w.r.t JOIN and sort order.