- 最后登录
- 2014-4-1
- 在线时间
- 34 小时
- 威望
- 0
- 金钱
- 122
- 注册时间
- 2013-7-2
- 阅读权限
- 10
- 帖子
- 48
- 精华
- 0
- 积分
- 0
- UID
- 1154
|
9#
发表于 2013-12-16 17:41:57
- Specify the Sql id
- ~~~~~~~~~~~~~~~~~~
- Enter value for sqlid: 6d0b2rq5dj5u9
- Sql Id specified: 6d0b2rq5dj5u9
- Elapsed: 00:00:00.01
- Tune the sql
- ~~~~~~~~~~~~
- Elapsed: 00:00:00.00
- Elapsed: 00:00:39.57
- GENERAL INFORMATION SECTION
- -------------------------------------------------------------------------------
- Tuning Task Name : TASK_59486
- Tuning Task Owner : SYS
- Workload Type : Single SQL Statement
- Scope : COMPREHENSIVE
- Time Limit(seconds): 1800
- Completion Status : COMPLETED
- Started at : 12/16/2013 17:18:30
- Completed at : 12/16/2013 17:19:08
- -------------------------------------------------------------------------------
- Schema Name: SYS
- SQL ID : 6d0b2rq5dj5u9
- SQL Text : select count(*)
- from xcxtt_sj_sjjbxx sj
- inner join xcxtt_sys_organization org
- on org.orgcode = sj.bldwid
- where sj.lrrq >= to_date('2013-11-01', 'yyyy-mm-dd
- hh24:mi:ss')
- and sj.lrrq < to_date('2013-11-30', 'yyyy-mm-dd
- hh24:mi:ss')
- and org.treepath like '11000000000000.11010600000000' || '%'
- -------------------------------------------------------------------------------
- FINDINGS SECTION (1 finding)
- -------------------------------------------------------------------------------
- 1- SQL Profile Finding (see explain plans section below)
- --------------------------------------------------------
- A potentially better execution plan was found for this statement.
- Recommendation (estimated benefit: 99.35%)
- ------------------------------------------
- - Consider accepting the recommended SQL profile.
- execute dbms_sqltune.accept_sql_profile(task_name => 'TASK_59486',
- task_owner => 'SYS', replace => TRUE);
- Validation results
- ------------------
- The SQL profile was tested by executing both its plan and the original plan
- and measuring their respective execution statistics. A plan may have been
- only partially executed if the other could be run to completion in less time.
- Original Plan With SQL Profile % Improved
- ------------- ---------------- ----------
- Completion Status: COMPLETE COMPLETE
- Elapsed Time(ms): 7339 50 99.31%
- CPU Time(ms): 7430 70 99.05%
- User I/O Time(ms): 0 0
- Buffer Gets: 188731 1209 99.35%
- Disk Reads: 0 0
- Direct Writes: 0 0
- Rows Processed: 1 1
- Fetches: 1 1
- Executions: 1 1
- -------------------------------------------------------------------------------
- EXPLAIN PLANS SECTION
- -------------------------------------------------------------------------------
- 1- Original With Adjusted Cost
- ------------------------------
- Plan hash value: 2027379502
- -----------------------------------------------------------------------------------------------------
- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
- -----------------------------------------------------------------------------------------------------
- | 0 | SELECT STATEMENT | | 1 | 93 | 316 (0)| 00:00:04 |
- | 1 | SORT AGGREGATE | | 1 | 93 | | |
- |* 2 | FILTER | | | | | |
- | 3 | NESTED LOOPS | | 25658 | 2330K| 316 (0)| 00:00:04 |
- |* 4 | INDEX RANGE SCAN| CIX_SYS_ORGANIZATION_TREECODE | 157 | 10990 | 2 (0)| 00:00:01 |
- |* 5 | INDEX RANGE SCAN| INDEX_SJ_SJJBXX_RQDW | 442 | 10166 | 2 (0)| 00:00:01 |
- -----------------------------------------------------------------------------------------------------
- Predicate Information (identified by operation id):
- ---------------------------------------------------
- 2 - filter(TO_DATE('2013-11-01','yyyy-mm-dd hh24:mi:ss')<TO_DATE('2013-11-30','yyyy-mm-dd
- hh24:mi:ss'))
- 4 - access("ORG"."TREEPATH" LIKE '11000000000000.11010600000000%')
- filter("ORG"."TREEPATH" LIKE '11000000000000.11010600000000%')
- 5 - access("SJ"."LRRQ">=TO_DATE('2013-11-01','yyyy-mm-dd hh24:mi:ss') AND
- "ORG"."ORGCODE"="SJ"."BLDWID" AND "SJ"."LRRQ"<TO_DATE('2013-11-30','yyyy-mm-dd hh24:mi:ss'))
- filter("ORG"."ORGCODE"="SJ"."BLDWID")
- 2- Original With Adjusted Cost
- ------------------------------
- Plan hash value: 2027379502
- -----------------------------------------------------------------------------------------------------
- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
- -----------------------------------------------------------------------------------------------------
- | 0 | SELECT STATEMENT | | 1 | 93 | 316 (0)| 00:00:04 |
- | 1 | SORT AGGREGATE | | 1 | 93 | | |
- |* 2 | FILTER | | | | | |
- | 3 | NESTED LOOPS | | 25658 | 2330K| 316 (0)| 00:00:04 |
- |* 4 | INDEX RANGE SCAN| CIX_SYS_ORGANIZATION_TREECODE | 157 | 10990 | 2 (0)| 00:00:01 |
- |* 5 | INDEX RANGE SCAN| INDEX_SJ_SJJBXX_RQDW | 442 | 10166 | 2 (0)| 00:00:01 |
- -----------------------------------------------------------------------------------------------------
- Predicate Information (identified by operation id):
- ---------------------------------------------------
- 2 - filter(TO_DATE('2013-11-01','yyyy-mm-dd hh24:mi:ss')<TO_DATE('2013-11-30','yyyy-mm-dd
- hh24:mi:ss'))
- 4 - access("ORG"."TREEPATH" LIKE '11000000000000.11010600000000%')
- filter("ORG"."TREEPATH" LIKE '11000000000000.11010600000000%')
- 5 - access("SJ"."LRRQ">=TO_DATE('2013-11-01','yyyy-mm-dd hh24:mi:ss') AND
- "ORG"."ORGCODE"="SJ"."BLDWID" AND "SJ"."LRRQ"<TO_DATE('2013-11-30','yyyy-mm-dd hh24:mi:ss'))
- filter("ORG"."ORGCODE"="SJ"."BLDWID")
- 3- Using SQL Profile
- --------------------
- Plan hash value: 2716384415
- -----------------------------------------------------------------------------------------------------
- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
- -----------------------------------------------------------------------------------------------------
- | 0 | SELECT STATEMENT | | 1 | 93 | 8 (38)| 00:00:01 |
- | 1 | SORT AGGREGATE | | 1 | 93 | | |
- |* 2 | FILTER | | | | | |
- |* 3 | HASH JOIN | | 25658 | 2330K| 8 (38)| 00:00:01 |
- |* 4 | INDEX RANGE SCAN| CIX_SYS_ORGANIZATION_TREECODE | 157 | 10990 | 2 (0)| 00:00:01 |
- |* 5 | INDEX RANGE SCAN| INDEX_SJ_SJJBXX_RQDW | 258K| 5804K| 3 (0)| 00:00:01 |
- -----------------------------------------------------------------------------------------------------
- Predicate Information (identified by operation id):
- ---------------------------------------------------
- 2 - filter(TO_DATE('2013-11-01','yyyy-mm-dd hh24:mi:ss')<TO_DATE('2013-11-30','yyyy-mm-dd
- hh24:mi:ss'))
- 3 - access("ORG"."ORGCODE"="SJ"."BLDWID")
- 4 - access("ORG"."TREEPATH" LIKE '11000000000000.11010600000000%')
- filter("ORG"."TREEPATH" LIKE '11000000000000.11010600000000%')
- 5 - access("SJ"."LRRQ">=TO_DATE('2013-11-01','yyyy-mm-dd hh24:mi:ss') AND
- "SJ"."LRRQ"<TO_DATE('2013-11-30','yyyy-mm-dd hh24:mi:ss'))
- -------------------------------------------------------------------------------
- Elapsed: 00:00:02.47
- Elapsed: 00:00:00.00
复制代码 |
|