Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Order of execution of Select clauses

Re: Order of execution of Select clauses

From: Joe Weinstein <joeNOSPAM_at_bea.com>
Date: Fri, 10 Feb 2006 13:47:37 -0800
Message-ID: <43ED09F9.2070000@bea.com>

Pria wrote:

> Hi All,
>
> Please correct me if i am wrong.
>
> Internally, the order of execution for a SELECT statement is as
> follows:
> FROM clause
> WHERE clause
> SELECT clause
> ORDER BY clause
> and Oracle allows Order by the table columns that are not included in
> the SELECT clause.
>
> If Order By clause is executed after select clause in select statement,
> then how does Oracle Order by columns that are not included in the
> SELECT clause internally.
>
> Thanks in Advance
> Pria

The whole query is parsed before it is executed. The query plan *will* internally select those columns, along with the asked-for data, perhaps filling a temp table internally. It then sorts the rows according to the columns you specify, and then just returns the columns you ask for.
HTH,
Joe Weinstein at BEA Systems Received on Fri Feb 10 2006 - 15:47:37 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US