- 最后登录
- 2016-4-21
- 在线时间
- 20 小时
- 威望
- 0
- 金钱
- 68
- 注册时间
- 2013-9-26
- 阅读权限
- 10
- 帖子
- 33
- 精华
- 0
- 积分
- 0
- UID
- 1234
|
1#
发表于 2013-12-24 15:34:04
|
查看: 4597 |
回复: 7
各位下午好:
环境:
OS: RHEL 5.8 X86_64
DB:11.2.0.3.7
如下sql
SELECT * FROM (SELECT S.SALESORDERBILLSTATEID, S.MOPOCSALESORDERBILLID, S.OUTERSALESORDERBILLID, MOPOCSOURCEORDERBILLID, OUTERSOURCEORDERBILLID, SHOPID, S.OWNERID, ORDERTYPEID, S.WAREHOUSEID, QTY, BILLSTATE, OLDBILL_STATE, STATE_DESC, CREATETIME, CREATEUSERID, S.DELIVERID, DELIVERNO, WEIGHT, WAYBILL_PACKAGEID, INPUTTYPEID, S.RECORDTIME, FROMSYSTEM, TASKSTATE , NVL(G.GROUPNO, '0') GROUPNO FROM IF_SALESORDER_BILLSTATE S LEFT JOIN IF_SALESORDER_GROUP G ON G.MOPOCSALESORDERBILLID = S.MOPOCSALESORDERBILLID WHERE S.TASKSTATE ='0' AND S.BILLSTATE > '00' ORDER BY RECORDTIME) WHERE ROWNUM < 1001;
执行计划为:
SQL> select * from table(dbms_xplan.display());
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 324440152
----------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
----------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1000 | 444K| | 52076 (2)| 00:03:09 |
|* 1 | COUNT STOPKEY | | | | | | |
| 2 | VIEW | | 616K| 267M| | 52076 (2)| 00:03:09 |
|* 3 | SORT ORDER BY STOPKEY | | 616K| 110M| 117M| 52076 (2)| 00:03:09 |
|* 4 | HASH JOIN RIGHT OUTER | | 616K| 110M| 54M| 29835 (2)| 00:01:49 |
| 5 | TABLE ACCESS FULL | IF_SALESORDER_GROUP | 1739K| 34M| | 5133 (3)| 00:00:19 |
|* 6 | TABLE ACCESS BY INDEX ROWID| IF_SALESORDER_BILLSTATE | 616K| 98M| | 21121 (1)| 00:01:17 |
|* 7 | INDEX RANGE SCAN | IK_IF_SALESORDER_BILLSTATE | 668K| | | 1991 (2)| 00:00:08 |
----------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter(ROWNUM<1001)
3 - filter(ROWNUM<1001)
4 - access("G"."MOPOCSALESORDERBILLID"(+)="S"."MOPOCSALESORDERBILLID")
6 - filter("S"."BILLSTATE">'00')
7 - access("S"."TASKSTATE"='0')
经过awr报告分析,物理IO过高,且Direct Reads占绝大部分,Direct Reads又主要是 IF_SALESORDER_GROUP这个表,请问针对这个sql怎么优化法呢? |
|