Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Top N Results From Aggregate Values in A Select
>But would the rank function do this more efficiently?
I dunno. Try to explain_plan both versions.
I prefer to use the analytic functions when I don't need groups or
aggregates or when I want to retrieve some columns I don't want to be
part of the aggregate : by specifying a PARTITION clause within my
analytic functions, I can achieve that.
> I am having a
>great deal of difficulty understanding the whole analytical processing
>aspect of Oracle.
PARTITION is equivalent to have a group by in your selection list,
grouping is sort of done once the rows of your resulset are retrieved.
ORDER BY clause lets you to apply an order to your rows for the purpose
of your calculations with analytic functions and spare the main ORDER
BY clause of your query to nicely present your results.
Have a look to the samples in the manual, they are quite explicit and
helpful.
Keep in mind that analytic functions are the last things to be
processed during query execution, these calculations occur after row
retrieving, group by aggregating but before sorting.
HTH
-- SLReceived on Thu Dec 08 2005 - 14:54:51 CST