"Rajesh Kumar Mallah" <mallah(dot)rajesh(at)gmail(dot)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