Speeding up this query? [message #65438] |
Tue, 21 September 2004 16:18 |
andy
Messages: 92 Registered: December 1999
|
Member |
|
|
SELECT /*+ ordered */
DISTINCT nds.Field1 a, nds.Field2 b, nds.Field3 c, nds.Field4 d
FROM db1.tableA nd, db1.tableB nds
WHERE nds.Field1 LIKE in_param1 || '%'
AND nds.Field1 = nd.Field1
AND nd.statuscode = 'A'
AND (UPPER(nds.Datastreamtype) IN ('I', 'P'))
AND nd.tni = UPPER(in_param2)
AND nds.Field1 NOT IN (SELECT pdw.Field1
FROM db2.Profile_Ds_Weights pdw
WHERE Profile_Data_SourceId = in_param3)
AND rownum <= 200
ORDER BY a, b;
tableA and tableB have approximately 12 million records each. Field1 is indexed on both tables. The query is running really slowly. Any suggestions on how to speed it up?
Thanks!
Andy
|
|
|
|