SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR('bbqffj0cd0qxm',NULL));
得知内容如下:
-
select title, itemid,formId,predictFinishTime
-
from (select mw.title,mw.itemid,mw.itemtype as formId,ia.predictFinishTime
-
from ta_***** tp,form_****** fw,mw_workitem mw,Item_******* ia
-
where tp.****='waiting'
-
and (tp.defName='??t·?? or tp.defName='??·?? or tp.defName='??·??)
-
and tp.rootinstid = fw.processid
-
and fw.itemid =mw.itemid
-
and mw.relatingRoom in ('2??ф-2???
-
------------------------------------------------------------------------------------------------------
-
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-
------------------------------------------------------------------------------------------------------
-
| 0 | SELECT STATEMENT | | | | 17302 (100)| |
-
| 1 | COUNT STOPKEY | | | | | |
-
| 2 | HASH JOIN | | 1 | 265 | 17302 (1)| 00:03:28 |
-
| 3 | NESTED LOOPS | | 4 | 812 | 10380 (1)| 00:02:05 |
-
| 4 | NESTED LOOPS | | 2752 | 812 | 10380 (1)| 00:02:05 |
-
| 5 | HASH JOIN | | 344 | 52632 | 8660 (1)| 00:01:44 |
-
| 6 | TABLE ACCESS FULL | MW_***** | 342 | 37962 | 8006 (1)| 00:01:37 |
-
| 7 | TABLE ACCESS FULL | FORM_***** | 290K| 11M| 652 (1)| 00:00:08 |
-
| 8 | INDEX RANGE SCAN | TAI_*****_ROOTID | 8 | | 2 (0)| 00:00:01 |
-
| 9 | TABLE ACCESS BY INDEX ROWID| TA_***** | 1 | 50 | 5 (0)| 00:00:01 |
-
| 10 | TABLE ACCESS FULL | ITEM_****** | 601K| 35M| 6918 (1)| 00:01:24 |
-
------------------------------------------------------------------------------------------------------
可以看到主要是部分表存在全表扫描,虽然表的数据量不大(约170w行),但是并发高的情况下可能还是会造成性能影响的。故考虑创建索引,如下:
-
create index *****.idx_*****_****_**** on ****.Item_******(***,***,****) online parallel 8 tablespace TBS_*****;
-
create index *****.idx_***** on *****.form_**** (*****) online tablespace TBS_*****;
-
create index *****.idx_*****_***** on *****.MW_****(*****,*****) online tablespace TBS_*****;