Thanks
Riyaj
<SPAN
class=450442819-22062001> It was the degree of
parallelism on the indexes.
<SPAN
class=450442819-22062001>
<SPAN
class=450442819-22062001>Brijesh
<FONT face=Tahoma
size=2>-----Original Message-----From: Riyaj_Shamsudeen_at_i2.com
[mailto:Riyaj_Shamsudeen_at_i2.com]Sent: Friday, June 22, 2001 1:39
PMTo: Multiple recipients of list ORACLE-LSubject: Re:
Rule base optimizer selecting different execution path ( Tuning
)Brijesh
There are few
conditions where the optimizer will select CBO even when the optimizer_mode is
set to rule. Do you have any objects in the schema with a parallelism >1
(tables and indexes) ? One of the common problem is that DBAs rebuild the
index with higher parallelism and forget to change the parallelism back to
noparallel. Parallelism >1 will turn on CBO. What is your optimizer_mode ?
I assume it is rule. Let us know if not. <FONT face=sans-serif
size=2> Seeing hash_join in your second plan, I am
positive that the CBO is being turned on. Do you have any hints in the code ?
Does your session change the optimizer_goal at the session level by any chance
? ThanksRiyaj "Re-yas"
ShamsudeenCertified Oracle DBAi2 technologies www.i2.com
"Gupta, Brijesh"
<Brijesh.Gupta_at_Airliquide.com> <FONT
face=sans-serif size=1>Sent by: root_at_fatcity.com
06/22/01 01:12 PM <FONT
face=sans-serif size=1>Please respond to ORACLE-L
<FONT
face=sans-serif size=1> To:
Multiple recipients of list ORACLE-L
<ORACLE-L_at_fatcity.com> <FONT face=sans-serif
size=1> cc:
Subject: Rule base optimizer selecting
different execution path ( Tuning
)<FONT face="Times New Roman"
size=2>Hi All,
Can somebody help me
in understanding this. <FONT
face="Times New Roman" size=2>We have a query which runs faster on
development and not on production.
When I checked the trace , it
using different execution path on both database.<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>Database is 8.0.5 running oracle application and the optimizer is
RULE.
Does anybody know why two execution
path oracle optimizer has selected when its a RULE base optimizer.<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>I know that is possible if its cost base optimizer but in rule it
should be same right ( All the indexes are same on both database )
Only thing I did was rebuild some of
the indexes on Test instance.
Thanks<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>Brijesh
Here is the explain plan of both the
database.
- Development Database
- <FONT
face="Times New Roman" size=2>Optimizer goal: RULE<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>Parsing user id: 45 (APPS)<FONT face="Times New Roman"
size=3> <FONT face="Times New Roman"
size=2>********************************************************************************<FONT
face="Times New Roman" size=3>
select<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>substr(mil.segment1||'.'||mil.segment2||'.'||mil.segment3,1,45)
Locator, <FONT
face="Times New Roman" size=2>mmt.subinventory_code
Subinventory, <FONT
face="Times New Roman" size=2>msi.segment1 PART_NO,<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>mmt.transaction_uom UOM,
<FONT face="Times New Roman"
size=2>sum(mmt.transaction_quantity)<FONT face="Times New Roman"
size=3> from<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>mtl_item_locations mil,
mtl_transaction_types
typ, <FONT
face="Times New Roman" size=2>mtl_material_transactions mmt,<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>mtl_system_items msi,
mtl_parameters mp<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>where <FONT
face="Times New Roman" size=2>mp.organization_code='768'<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>and mp.organization_id+0=msi.organization_id<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>and msi.organization_id=mmt.organization_id<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>and msi.inventory_item_id=mmt.inventory_item_id<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>and trunc(mmt.transaction_date) between '01-APR-01' and
'31-MAY-01' <FONT
face="Times New Roman" size=2>and
mmt.transaction_type_id=typ.transaction_type_id<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>and typ.transaction_type_name='Account alias receipt'<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>and mmt.locator_id=mil.inventory_location_id(+)<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>and mmt.organization_id=mil.organization_id(+)<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>and mil.subinventory_code = 'CORROSIVE'<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>group by mil.segment1,
mil.segment2,<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>mil.segment3,
<FONT face="Times New Roman"
size=2>mmt.subinventory_code,
msi.segment1,<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>mmt.transaction_uom
call count
cpu elapsed disk
query current rows<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>------- ------ -------- ---------- ---------- ----------
- ----------
Parse
1 0.01 0.01
0 0
0 0<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>Execute 1 0.00
0.00 0
0 0
0 <FONT
face="Times New Roman" size=2>Fetch 2
51.68 901.33 85134
395083 0
4 <FONT
face="Times New Roman" size=2>------- ------ -------- ----------
- ---------- ---------- ----------<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>total 4 51.69
901.34 85134 395083
0 4<FONT
face="Times New Roman" size=3>
Misses in library cache during parse:
0 <FONT
face="Times New Roman" size=2>Optimizer goal: RULE<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>Parsing user id: 45 (APPS)<FONT face="Times New Roman"
size=3>
Rows Execution
Plan <FONT
face="Times New Roman" size=2>-------
---------------------------------------------------<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2> 0 SELECT STATEMENT GOAL:
RULE <FONT
face="Times New Roman" size=2> 4 SORT (GROUP
BY) <FONT
face="Times New Roman" size=2> 33
FILTER <FONT
face="Times New Roman" size=2> 32 NESTED LOOPS
(OUTER) <FONT
face="Times New Roman" size=2> 33 NESTED
LOOPS <FONT
face="Times New Roman" size=2> 132 NESTED
LOOPS <FONT
face="Times New Roman" size=2> 2445
NESTED LOOPS <FONT
face="Times New Roman" size=2> 1
TABLE ACCESS (BY INDEX ROWID) OF 'MTL_PARAMETERS'<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2> 2 INDEX
(RANGE SCAN) OF 'ORGANIZATION_CODE'
(NON-UNIQUE)<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2> 2445 TABLE ACCESS GOAL:
ANALYZED (BY INDEX ROWID) OF
'MTL_SYSTEM_ITEMS'<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2> 2446 INDEX GOAL:
ANALYZED (RANGE SCAN) OF
'MTL_SYSTEM_ITEMS_N1'
(NON-UNIQUE) <FONT
face="Times New Roman" size=2>194874 TABLE
ACCESS GOAL: ANALYZED (BY INDEX ROWID) OF<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>
'MTL_MATERIAL_TRANSACTIONS'
846350
AND-EQUAL <FONT
face="Times New Roman" size=2>500017
INDEX (RANGE SCAN) OF 'ORGANIZATION_ID'<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>
(NON-UNIQUE) <FONT
face="Times New Roman" size=2>348778
INDEX (RANGE SCAN) OF 'INVENTORY_ITEM_ID'<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>
(NON-UNIQUE) <FONT
face="Times New Roman" size=2> 132 TABLE
ACCESS GOAL: ANALYZED (BY INDEX ROWID) OF<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>
'MTL_TRANSACTION_TYPES'
132
INDEX GOAL: ANALYZED (UNIQUE SCAN) OF<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>
'MTL_TRANSACTION_TYPES_U1' (UNIQUE)
32
TABLE ACCESS (BY INDEX ROWID) OF 'MTL_ITEM_LOCATIONS'<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2> 32 INDEX GOAL: ANALYZED
(UNIQUE SCAN) OF <FONT
face="Times New Roman" size=2>
'MTL_ITEM_LOCATIONS_U1' (UNIQUE)<FONT
face="Times New Roman" size=3>
<FONT face="Times New Roman"
size=2>********************************************************************************<FONT
face="Times New Roman" size=3>
- TEST Database
*********** <FONT
face="Times New Roman" size=2>Optimizer goal: RULE<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>Parsing user id: 45 (APPS)<FONT face="Times New Roman"
size=3> <FONT face="Times New Roman"
size=2>********************************************************************************<FONT
face="Times New Roman" size=3>
select<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>substr(mil.segment1||'.'||mil.segment2||'.'||mil.segment3,1,45)
Locator, <FONT
face="Times New Roman" size=2>mmt.subinventory_code
Subinventory, <FONT
face="Times New Roman" size=2>msi.segment1 PART_NO,<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>mmt.transaction_uom UOM,
<FONT face="Times New Roman"
size=2>sum(mmt.transaction_quantity)<FONT face="Times New Roman"
size=3> from<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>mtl_item_locations mil,
mtl_transaction_types
typ, <FONT
face="Times New Roman" size=2>mtl_material_transactions mmt,<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>mtl_system_items msi,
mtl_parameters mp<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>where <FONT
face="Times New Roman" size=2>mp.organization_code='768'<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>and mp.organization_id+0=msi.organization_id<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>and msi.organization_id=mmt.organization_id<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>and msi.inventory_item_id=mmt.inventory_item_id<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>and trunc(mmt.transaction_date) between '01-APR-01' and
'31-MAY-01' <FONT
face="Times New Roman" size=2>and
mmt.transaction_type_id=typ.transaction_type_id<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>and typ.transaction_type_name='Account alias receipt'<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>and mmt.locator_id=mil.inventory_location_id(+)<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>and mmt.organization_id=mil.organization_id(+)<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>and mil.subinventory_code = 'CORROSIVE'<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>group by mil.segment1,
mil.segment2,<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>mil.segment3,
<FONT face="Times New Roman"
size=2>mmt.subinventory_code,
msi.segment1,<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>mmt.transaction_uom
call count
cpu elapsed disk
query current rows<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>------- ------ -------- ---------- ---------- ----------
- ----------
Parse
1 0.00 0.00
0 0
0 0<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>Execute 1 0.00
0.00 0
0 0
0 <FONT
face="Times New Roman" size=2>Fetch 6
3718.80 3718.10 211 59865263
9
68 <FONT
face="Times New Roman" size=2>------- ------ -------- ----------
- ---------- ---------- ----------<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>total 8 3718.80
3718.10 211 59865263
9 68<FONT
face="Times New Roman" size=3>
Misses in library cache during parse:
0 <FONT
face="Times New Roman" size=2>Optimizer goal: RULE<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>Parsing user id: 45 (APPS)<FONT face="Times New Roman"
size=3>
Rows Execution
Plan <FONT
face="Times New Roman" size=2>-------
---------------------------------------------------<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2> 0 SELECT STATEMENT GOAL:
RULE <FONT
face="Times New Roman" size=2> 87 SORT (GROUP
BY) <FONT
face="Times New Roman" size=2> 87 HASH
JOIN <FONT
face="Times New Roman" size=2> 87 NESTED
LOOPS <FONT
face="Times New Roman" size=2> 87 HASH
JOIN <FONT
face="Times New Roman" size=2> 4557 NESTED
LOOPS <FONT
face="Times New Roman" size=2> 8764 TABLE
ACCESS (FULL) OF 'MTL_ITEM_LOCATIONS'<FONT face="Times New Roman"
size=3> 57874905
TABLE ACCESS GOAL: ANALYZED (BY INDEX ROWID)
OF <FONT
face="Times New Roman" size=2>
'MTL_MATERIAL_TRANSACTIONS'<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2>386356905 INDEX GOAL: ANALYZED
(RANGE SCAN) OF <FONT
face="Times New Roman" size=2>
'MTL_MATERIAL_TRANSACTIONS_N5'
(NON-UNIQUE) <FONT
face="Times New Roman" size=2> 43 TABLE
ACCESS GOAL: ANALYZED (FULL) OF<FONT face="Times New Roman"
size=3>
'MTL_TRANSACTION_TYPES'<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2> 87 TABLE ACCESS GOAL:
ANALYZED (BY INDEX ROWID) OF
'MTL_SYSTEM_ITEMS'<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2> 87 INDEX GOAL: ANALYZED
(UNIQUE SCAN) OF <FONT
face="Times New Roman" size=2>
'MTL_SYSTEM_ITEMS_U1' (UNIQUE)<FONT
face="Times New Roman" size=3> <FONT face="Times New Roman"
size=2> 223 TABLE ACCESS (FULL) OF
'MTL_PARAMETERS'
<FONT face="Times New Roman"
size=2>********************************************************************************<FONT
face="Times New Roman" size=3>
Received on Fri Jun 22 2001 - 14:26:07 CDT