NOT IN Clause suppresses index.
The sql statement below uses the NOT IN clause, which causes Oracle to not utlizie the index on the column(rpt_id). Any one has any suggestion on how i can re write this query so that it does use the index? I could get rid of the NOT and just use the IN clause. However, then I would have to list all the reports that I am looking for which is a lot.
Select *
from PRFMNC_EVAL_FCT
WHERE PRFMNC_EVAL_FCT.RPT_ID IN ('MIS-BP-NCL1','MIS-BP-NCL6','MIS-CT-CL6','MIS-CT-CL7','MIS-PRCOR-CL6') OR PRFMNC_EVAL_FCT.RPT_ID||PRFMNC_EVAL_FCT.TIME_ID||PRFMNC_EVAL_FCT.MIS_LOAD_ID
IN(SELECT PRFMNC_EVAL_FCT.RPT_ID||MAX( PRFMNC_EVAL_FCT.TIME_ID)||MAX(PRFMNC_EVAL_FCT.MIS_LOAD_ID)
FROM PRFMNC_EVAL_FCT PRFMNC_EVAL_FCT
WHERE PRFMNC_EVAL_FCT.RPT_ID NOT IN ('MIS-BP-NCL1','MIS-BP-NCL6','MIS-CT-CL6','MIS-CT-CL7','MIS-PRCOR-CL6')
GROUP BY PRFMNC_EVAL_FCT.RPT_ID
UNION
SELECT PRFMNC_EVAL_FCT.RPT_ID||MAX( PRFMNC_EVAL_FCT.TIME_ID)||0
FROM PRFMNC_EVAL_FCT PRFMNC_EVAL_FCT
WHERE PRFMNC_EVAL_FCT.RPT_ID not IN ('MIS-BP-NCL1','MIS-BP-NCL6','MIS-CT-CL6','MIS-CT-CL7','MIS-PRCOR-CL6')
GROUP BY PRFMNC_EVAL_FCT.RPT_ID )