Pages

Wednesday, September 25, 2013

11g / Rule Based


Set opt mode:

 
alter session set optimizer_mode=RULE/CHOOSE/ALL_ROWS;

show parameter optimizer_mode;
 
delete stats: 
exec dbms_stats.delete_table_stats('HR','EMPLOYEES',cascade_indexes=>true);
select last_analyzed from user_tables where table_name='EMPLOYEES'; (should be null);
select last_analyzed from user_indexes where table_name='EMPLOYEES'; (should be null);
Explain 

EXPLAIN PLAN FOR SELECT XXXXX.....;
SELECT * FROM TABLE(dbms_xplan.display); 
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 3296909491
---------------------------------------------------------------
| Id  | Operation                       | Name                |
---------------------------------------------------------------
|   0 | SELECT STATEMENT                |                     |
|*  1 |  FILTER                         |                     |
|*  2 |   TABLE ACCESS BY INDEX ROWID   | PS_x_xxx_xxx        |
|*  3 |    INDEX RANGE SCAN             | PS_X_XXX_XXX        |
|   4 |   CONCATENATION                 |                     |
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
--------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 1 - filter( EXISTS (SELECT 0 FROM "PS_SPEEDCHART_HDR" "SYS_ALIAS_2","PS_H_PRC_ORDER_HDR3" "SYS_ALIAS_3")
PLAN_TABLE_OUTPUT
---------------------------------------------------------------------
:::::::::::::::::::::::::::::::
 
Note
-----
   - rule based optimizer used (consider using cbo)

114 rows selected.