instead of OR clause.. split it as union or better use concat.. and also collect histograms on all tables and all indexed columns with appropriate bucket size of around 100.
funky...
"I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."
"Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"
Tamil, There already is an index on u.org_unit_id column.
Abhaysk, Using an UNION ALL Clause brought down the execution time to 37secs but the CPU usage is still 99%. Here is a part of the query in the UNION that is using the maximum resources.
Code:
SELECT COUNT (cai.assessment_instance_id) AS assignments_mapped
FROM CLG_ASSESSMENT_RESULT car,
CLG_ITEM_RESULT cir,
CLG_ITEM ci,
CLG_CORRELATION CORR,
CLG_ASSESSMENT_INSTANCE cai,
CB_STANDARD cbs,
CLG_USER u
WHERE car.assessment_result_id = cir.assessment_result_id
AND car.status = 20
AND car.completed_date >= TO_DATE ('09052006', 'mmddyyyy')
AND car.completed_date <= TO_DATE ('10132006', 'mmddyyyy')
AND car.assessment_instance_id = cai.assessment_instance_id
AND cai.assignor_id = u.user_id
AND u.org_unit_id = 21296
AND cir.item_locator = ci.LOCATOR
AND CORR.content_id = ci.LOCATOR
AND CORR.asset_type_id = 113
AND CORR.cbs_id = cbs.cbs_id
AND cbs.LOCATOR LIKE '1.1026%' -- INPUT: subject Writing; grade 6
AND BITAND (cbs.internal_grade_levels, 2) > 0
Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
SELECT STATEMENT Optimizer Mode=CHOOSE 1 30
SORT AGGREGATE 1 163
TABLE ACCESS BY INDEX ROWID CSI.CLG_ITEM_RESULT 1 41 3
NESTED LOOPS 1 163 30
NESTED LOOPS 1 122 27
NESTED LOOPS 1 97 26
MERGE JOIN CARTESIAN 1 62 22
NESTED LOOPS 1 38 20
NESTED LOOPS 3 84 14
TABLE ACCESS BY INDEX ROWID CSI.CLG_ASSESSMENT_RESULT 3 54 11
INDEX RANGE SCAN CSI.IDX_ASMNTRES_COMPDATE 38 3
TABLE ACCESS BY INDEX ROWID CSI.CLG_ASSESSMENT_INSTANCE 1 10 1
INDEX UNIQUE SCAN CSI.PK_ASSESSMENT_INSTANCE 1
TABLE ACCESS BY INDEX ROWID CSI.CLG_USER 1 10 2
INDEX UNIQUE SCAN CSI.PK_USER 1 1
BUFFER SORT 1 24 20
TABLE ACCESS BY INDEX ROWID CSI.CB_STANDARD 1 24 2
INDEX RANGE SCAN CSI.UK_CB_STANDARD_LOCATOR 1 1
INDEX RANGE SCAN CSI.IDX_CORR_MLO_CONTENT_ASSET 28 980 4
INDEX UNIQUE SCAN CSI.PK_ITEM 1 25 1
INDEX RANGE SCAN CSI.PK_ITEM_RESULT 13 2
Bookmarks