From: Tom Lane <tgl@sss.pgh.pa.us>
To: Rajesh Kumar Mallah <mallah.rajesh@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: ordering of selected rows from an ordered subselect
Date: Sat, 17 Feb 2007 11:31:34 -0500
Message-ID: <19515.1171729894@sss.pgh.pa.us> (raw)
In-Reply-To: <a97c77030702170132h51962513j929786b4f45aa50f@mail.gmail.com>
References: <a97c77030702170132h51962513j929786b4f45aa50f@mail.gmail.com>
"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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, mallah.rajesh@gmail.com
Subject: Re: ordering of selected rows from an ordered subselect
In-Reply-To: <19515.1171729894@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox