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: nested SQL query

Re: nested SQL query

From: Svend Jensen <Master_at_OracleCare.Com>
Date: Mon, 28 Jan 2002 19:12:12 +0100
Message-ID: <3C55947C.7080000@OracleCare.Com>


Erik wrote:

> I don't know if this is the correct newsgroup, but I was not able to
> find a SQL group.
>
> Just a short question:
> Is it OK to use such SQL Statements:
>
> select REVISION, SHEETIDX from sheet where REVISION=(select
> MAX(REVISION) from SHEET);
>
> Problem is I want the sheetidx with the highest revision.
>
> Is there a solution with better performance (without a nest) ?
>
> regards,
>
> Erik
>

Erik, the query is OK. Select MAX(REVISION) from SHEET, will be executed first, and performs nice with at index FFS or max/min if revision is indexed normal or unique (not reverse, nor desc...) Then you get table access sheet by index rowid. Depending on table/index size, you probably get 1-4 reads from the index and one from the table, in all 5. Not to bad. If the table were IOT, you might save a read with small row sizes.

/Svend Jensen Received on Mon Jan 28 2002 - 12:12:12 CST

Original text of this message

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