Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: nested SQL query
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
![]() |
![]() |