Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> [Q] SQL statement that Rule base run faster than cost base!!
I have foloowing SQL statement, it run a lot faster on Rule mode (18
seconds) than cost mode (10 min) under ORACLE 7.3.4. Does anyone know
why?
I list output from TKPROF :
select distinct FACILITY_ATTRIBUTE.facility_attribute_id,
FACILITY_ATTRIBUTE.title, FACILITY_ATTRIBUTE.internet_query_flag
from
FACILITY, FACILITY_TYPE, FACILITY_MASTER, FACILITY_FEATURE,
FACILITY_ATTRIBUTE where FACILITY.facility_master_id = FACILITY_MASTER.facility_master_id and FACILITY.facility_type_id = FACILITY_TYPE.facility_type_id and FACILITY.facility_id = FACILITY_FEATURE.facility_id and FACILITY_FEATURE.facility_attribute_id = FACILITY_ATTRIBUTE.facility_attribute_id andFACILITY.internet_query_flag <> 0 and FACILITY_ATTRIBUTE.internet_query_flag <> 0 order by FACILITY_ATTRIBUTE.title
call count cpu elapsed disk query current
rows
------- ------ -------- ---------- ---------- ---------- ----------
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: 11 (USER1)
Rows Execution Plan
------- --------------------------------------------------- 0 SELECT STATEMENT GOAL: CHOOSE23081 SORT (UNIQUE)
2256300 NESTED LOOPS 2256300 HASH JOIN 12535 TABLE ACCESS GOAL: ANALYZED (FULL) OF 'FACILITY' 17280 MERGE JOIN (CARTESIAN) 180 TABLE ACCESS GOAL: ANALYZED (FULL) OF 'FACILITY_ATTRIBUTE' 96 SORT (JOIN) 97 INDEX GOAL: ANALYZED (FULL SCAN) OF 'XPKFACILITY_TYPE' (UNIQUE) 2256300 INDEX GOAL: ANALYZED (UNIQUE SCAN) OF 'XPKFACILITY_MASTER' (UNIQUE) 2256300 INDEX GOAL: ANALYZED (UNIQUE SCAN) OF 'XPKFACILITY_FEATURE' (UNIQUE)
B. use "rule" base mode
select distinct FACILITY_ATTRIBUTE.facility_attribute_id,
FACILITY_ATTRIBUTE.title, FACILITY_ATTRIBUTE.internet_query_flag
from
FACILITY, FACILITY_TYPE, FACILITY_MASTER, FACILITY_FEATURE,
FACILITY_ATTRIBUTE where FACILITY.facility_master_id = FACILITY_MASTER.facility_master_id and FACILITY.facility_type_id = FACILITY_TYPE.facility_type_id and FACILITY.facility_id = FACILITY_FEATURE.facility_id and FACILITY_FEATURE.facility_attribute_id = FACILITY_ATTRIBUTE.facility_attribute_id andFACILITY.internet_query_flag <> 0 and FACILITY_ATTRIBUTE.internet_query_flag <> 0 order by FACILITY_ATTRIBUTE.title
call count cpu elapsed disk query current
rows
------- ------ -------- ---------- ---------- ---------- ----------
Misses in library cache during parse: 1
Optimizer goal: RULE
Parsing user id: 11 (USER1)
Rows Execution Plan
------- --------------------------------------------------- 0 SELECT STATEMENT GOAL: RULE
23081 NESTED LOOPS 23081 NESTED LOOPS 23081 NESTED LOOPS 180 TABLE ACCESS GOAL: ANALYZED (FULL) OF 'FACILITY_ATTRIBUTE' 23081 TABLE ACCESS GOAL: ANALYZED (BY ROWID) OF 'FACILITY_FEATURE' 23261 INDEX GOAL: ANALYZED (RANGE SCAN) OF 'XIE1FACILITY_FEATURE' (NON-UNIQUE) 23081 TABLE ACCESS GOAL: ANALYZED (BY ROWID) OF 'FACILITY' 23081 INDEX GOAL: ANALYZED (UNIQUE SCAN) OF 'XPKFACILITY' (UNIQUE) 23081 INDEX GOAL: ANALYZED (UNIQUE SCAN) OF 'XPKFACILITY_MASTER' (UNIQUE)Received on Tue Dec 05 2000 - 13:29:40 CST
![]() |
![]() |