背景:
某表忽然出现查询非常缓慢的情况,cost 100+ 秒以上;严重影响生产。
Oracle入门教程:leading vs ordered hint
Oracle hint 实践一列 leanding 驱动表和hash多块读取
Oracle优化常用hint语句
Oracle调优hint提示
原SQL:
explain plan for
select * from (
select ID id,RET_NO retNo, FROM_SYS fromSy, TO_SYS toSys, COMMAND_CODE commandCode, COMMAND, STATUS,
EXT_CODE, ORIGN_CODE orignCode,error_message errorMessage, RE_F, RET_MSG retMsg
from interface_table where ((command_code in('AASSS')
and status in('F','E') and (re_f = 'N') and FROM_SYS = 'MEE')
or (COMMAND_CODE in('XXXX','XXXX9') and FROM_SYS = 'EXT' and RE_F = 'N')
) and MOD(id, 1) = 0 order by id) where rownum