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

Home -> Community -> Mailing Lists -> Oracle-L -> sql optimization question

sql optimization question

From: Guang Mei <gmei_at_incyte.com>
Date: Wed, 27 Aug 2003 09:59:27 -0800
Message-ID: <F001.005CD822.20030827095927@fatcity.com>


Hi,

This query took a few minues to return 126K rows (fast):

select distinct n.cognateid, m.isirefid,4, linkdate from mt.externallink l, refidmatch m, nametag n where l.objectid = n.geneid
and m.pubmedid = l.identifier
and externaldbid = 9;

But this query took hours and still no result, I had to kill it:

select distinct n.cognateid, m.isirefid,4, linkdate from mt.externallink l, refidmatch m, nametag n where l.objectid = n.geneid
and m.pubmedid = l.identifier
and externaldbid = 9
and (select count(distinct objectid) from mt.externallink k

     where k.identifier = l.identifier
     and externaldbid = 9
     and l.objectid !=k.objectid)<5;


All the related columns are indexed and table are analyzed. Is there a way to re-write the part

select count(distinct objectid) from mt.externallink k

     where k.identifier = l.identifier
     and externaldbid = 9
     and l.objectid !=k.objectid)<5

to make the whole thing faster?

TIA. Guang

--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: Guang Mei
  INET: gmei_at_incyte.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
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 Wed Aug 27 2003 - 12:59:27 CDT

Original text of this message

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