我有一个Oracle查询,它在某些环境中偶尔使用执行速度非常慢的执行计划。
我可以采取哪些步骤来优化此查询,使其始终使用更快的执行计划?或者换句话说,是否有任何特定的领域特别低效或迂回?
select
'RECEIVE-DONE' OP_TYPE,
sbmt.SUBMIT_NO,
wsr.USE_LUMP_PROC,
sf.*
from (
select
my.flow_id myflow_id,
done.flow_id flow_id,
done.status SFSTATUS,
from submit_flow my , submit_flow done
where my.submit_id=done.submit_id
and my.check_ord=done.check_ord
and my.emp_id = '1'
and done.status
in (1,2,3,4)
and ( (done.mainflow=1 and done.check_ord > 0) or (done.emp_id ='1' and done.type in (1,2,3) and done.type = my.type ) )
) sf,
submit_list sbmt, wfserveroute wsr, emp emp
where
sbmt.EMP_ID = emp.EMP_ID
and sf.SUBMIT_ID = sbmt.SUBMIT_ID
and ((sf.TYPE = 1 and sbmt.COMPLETED = 1 and sbmt.status = 2) or (sf.TYPE <> 1))
and sbmt.FLOW_SCHEM = wsr.SCHEM
and sbmt.SERVICENAME = wsr.FULLNAME
and wsr.CASE = 0
and not exists(
SELECT 1 FROM service_mst smst
WHERE (smst.namespace||'.'||smst.name) = sbmt.SERVICENAME
and smst.not_view_at_inouttray = 1
) order by sf.prc_date DESC
我发现执行计划中的Table Access Full和Merge Join Cartesian的示例在速度方面不太理想,但我不确定为了鼓励使用不包括它们的计划,需要对SQL进行有形的修改。
应更新用于为有关表格制定计划的统计数据。
1条答案
按热度按时间tnkciper1#
对于这种查询,