Re: query for top 10 sql?

  • From: Mladen Gogala <mladen@xxxxxxxxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Thu, 11 Mar 2004 13:43:57 -0500

On 03/11/2004 10:39:05 AM, Igor Neyman wrote:
> Obviously in this case (second out of 3) it doesn't make any difference.
> But, if asked for top 10 out of 1000:
> - Without optimization: all 1000 would have been sorted;
> - With optimization: find top 10 and stop, no need to sort the rest 990.
> 
> Igor Neyman, OCP DBA
> ineyman@xxxxxxxxxxxxxx
> 
> 

Quite frankly, I still don't know which book are you referring to, "effective 
oracle" or "101"
and, if "1-on-1", which edition? I'm asking because  things don't look very 
logical to me,
so I'd like to read them. I'd be thankful if you specified the book more 
closely.
It doesn't look logical to me to sort only 10 out of 1000 if I want to find the 
10 maximal ones.
Namely, to find 10 largest, I need to sort them all. I can stop producing 
output after 10th
row, but I must sort them all, or use some fancy sort algorithm, significantly 
slower then
topological sort or quick sort (see Knuth for the description of those). Tom's 
explanation
of those seemingly contradicting facts is probably wonderful and I'd like to 
read it. As I have
all 3 of his books, I'd appreciate if you could reveal your source.
----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: