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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: query for top customer

RE: query for top customer

From: Thomas, Kevin <Kevin.Thomas_at_calanais.com>
Date: Tue, 11 Sep 2001 01:42:32 -0700
Message-ID: <F001.00389321.20010911005520@fatcity.com>

Thanks Greg,

;-) I needed that! I just got into PL/SQL mode and went for it....LOL

Cheers,
Kev.

"hit any user to continue"


Kevin Thomas
Technical Analyst
Deregulation Services
Calanais Ltd.
(2nd Floor East - Weirs Building)
Tel: 0141 568 2377
Fax: 0141 568 2366
http://www.calanais.com

-----Original Message-----
Sent: 11 September 2001 05:30
To: Multiple recipients of list ORACLE-L

> Here's me publishing war-n-peace to solve
> a problem that takes 4 lines of code...

True, but your PL/SQL solution is fast.

Using a correlated subquery to find the top three rows works fine against EMP, but what happens when it goes against a table with 100,000 rows? This subquery runs 100,000 times:

where 3 > (select count(*) from tablea y where y.sales > x.sales)

The correlated subquery solution will run forever and a day, and an index won't help. If you can't do an in-line view, forget the correlated subquery, no matter how short it is, and use PL/SQL.

Am I missing something here?

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Greg Moore
  INET: sqlgreg_at_pacbell.net

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Thomas, Kevin
  INET: Kevin.Thomas_at_calanais.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Tue Sep 11 2001 - 03:42:32 CDT

Original text of this message

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