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: sql optimization question

RE: sql optimization question

From: Guang Mei <gmei_at_incyte.com>
Date: Thu, 28 Aug 2003 08:34:26 -0800
Message-ID: <F001.005CDC1D.20030828083426@fatcity.com>


Dave:

Thanks! That works great.

Guang

-----Original Message-----
Dave Hau
Sent: Wednesday, August 27, 2003 4:29 PM To: Multiple recipients of list ORACLE-L

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 l.identifier in
(select identifier from mt.externallink
where externaldbid = 9
group by identifier
having count(distinct objectid) < 6);

HTH,
Dave

gmei_at_incyte.com wrote:
> 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 Thu Aug 28 2003 - 11:34:26 CDT

Original text of this message

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