Re: ordering of selected rows from an ordered subselect - Mailing list pgsql-sql

From Tom Lane
Subject Re: ordering of selected rows from an ordered subselect
Date
Msg-id 19515.1171729894@sss.pgh.pa.us
Whole thread Raw
In response to ordering of selected rows from an ordered subselect  ("Rajesh Kumar Mallah" <mallah.rajesh@gmail.com>)
List pgsql-sql
"Rajesh Kumar Mallah" <mallah.rajesh@gmail.com> writes:
> select   id , name , expensive_func(name)  from
>         ( select id , name from tab  order by c1 desc limit 15)  as foo ;
> is it guaranteed that the final result is order by c1 ?

The sub-select's output will be emitted in the specified order.  What
happens after that depends on the outer query, but if you don't have any
joining or grouping then it's a reasonably safe bet that the final
output will be in the same order.
        regards, tom lane


pgsql-sql by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: ordering of selected rows from an ordered subselect
Next
From: "M.P.Dankoor"
Date:
Subject: Re: sub-limiting a query