added sql profile
时间:2010-09-01 来源:2jliu
SQL> SELECT DBMS_SQLTUNE.REPORT_TUNING_TASK( 'tuning_task_1') from DUAL;
DBMS_SQLTUNE.REPORT_TUNING_TASK('TUNING_TASK_1')
----------------------------------------------------------------------------------------------------
GENERAL INFORMATION SECTION
-------------------------------------------------------------------------------
Tuning Task Name : tuning_task_1
Tuning Task Owner : ORACLE
Scope : COMPREHENSIVE
Time Limit(seconds) : 60
Completion Status : COMPLETED
Started at : 08/31/2010 15:26:53
Completed at : 08/31/2010 15:26:53
Number of SQL Profile Findings : 1
DBMS_SQLTUNE.REPORT_TUNING_TASK('TUNING_TASK_1')
----------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Schema Name: ORACLE
SQL ID : 6xakxv5xdjwdb
SQL Text : select /*+ no_index(test test_idx) */ * from oracle.test where
n=1
-------------------------------------------------------------------------------
FINDINGS SECTION (1 finding)
-------------------------------------------------------------------------------
1- SQL Profile Finding (see explain plans section below)
DBMS_SQLTUNE.REPORT_TUNING_TASK('TUNING_TASK_1')
----------------------------------------------------------------------------------------------------
--------------------------------------------------------
A potentially better execution plan was found for this statement.
Recommendation (estimated benefit: 97.71%)
------------------------------------------
- Consider accepting the recommended SQL profile.
execute dbms_sqltune.accept_sql_profile(task_name => 'tuning_task_1',
replace => TRUE);
-------------------------------------------------------------------------------
EXPLAIN PLANS SECTION
DBMS_SQLTUNE.REPORT_TUNING_TASK('TUNING_TASK_1')
----------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------
1- Original With Adjusted Cost
------------------------------
Plan hash value: 1357081020
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 4 | 44 (5)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| TEST | 1 | 4 | 44 (5)| 00:00:01 |
DBMS_SQLTUNE.REPORT_TUNING_TASK('TUNING_TASK_1')
----------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("N"=1)
2- Using SQL Profile
--------------------
Plan hash value: 2882402178
DBMS_SQLTUNE.REPORT_TUNING_TASK('TUNING_TASK_1')
----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 4 | 1 (0)| 00:00:01 |
|* 1 | INDEX RANGE SCAN| TEST_IDX | 1 | 4 | 1 (0)| 00:00:01 |
-----------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("N"=1)
DBMS_SQLTUNE.REPORT_TUNING_TASK('TUNING_TASK_1')
----------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------
SQL>