对oracle系统做了个ADDM(自动数据库诊断监控)报告,对下面的sql看了下执行计划。
1、delete from lhomswas.OMS_SYS_XPTASK_COMM osx where osx.sync_flag like :1
执行计划:
全表扫描:
cost:6079
cardinality:342
bytes:3078
创建索引:
create index sync_flag_OMS_SYS_XPTASK_COMM
on oms_sys_xptask_comm(sync_flag)
tablespace PUB_NORM_SPACE;
创建索引后的执行计划:
索引扫描:
cost:3
cardinality:342
bytes:3078
花费时间大大减少
2、 select task.* from lhomswas.OMS_SYS_XPTASK_GPE task where
task.table_name in (:1,:2,:3,:4,:5) and task.sync_flag like :6 and
rownum<=:7 order by task.create_date asc
执行计划:
全表扫描:
cost:526
cardinality:101
bytes:19190
创建索引:
create index sync_flag_OMS_SYS_XPTASK_GPE
on oms_sys_xptask_gpe(sync_flag)
tablespace PUB_NORM_SPACE;
创建索引后的执行计划:
索引扫描:
cost:3
cardinality:563
bytes:0
花费时间大大减少
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12778571/viewspace-573404/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/12778571/viewspace-573404/