0
我有下面的選擇查詢這是長期運行,我想查看查詢執行計劃,以瞭解爲什麼這個查詢是長期運行和SQL查詢中的哪個語句影響查詢性能。我正在使用oracle sql開發人員,我檢查了以下查詢的解釋計劃,但沒有清楚地理解哪個語句正在影響我的查詢以便優化我的查詢。在oracle中的長時間運行查詢的解釋計劃sql99
Select *
from [email protected]_RETAIL PL
JOIN [email protected]_RETAIL PT ON PL.PROVISIONING_TASK_ID = PT.ID JOIN [email protected]_RETAIL SER ON PT.SERVICE_ID = SER.ID
JOIN TEMP_WF_DEF_ALL TT ON SER.SUBSCRIPTION_ID = TT.SUBSCRIPTION_ID
where PT.CODE='MIGOPT_PACK' and PT.DESCRIPTION Like '%CVB Request' AND PT.PARAMETERS LIKE '%OPERATION=ADD%' AND PL.RESPONSE_TYPE IS NULL AND PL.REQUEST IS NOT NULL
and ((to_char(PT.START_DATE,'YYYYMMDDHH24Mi') = to_char(TT.COMPLETE_DATE,'YYYYMMDDHH24Mi'))
or (to_char(PT.START_DATE,'YYYYMMDDHH24Mi') = to_char(TT.COMPLETE_DATE + 1/1440,'YYYYMMDDHH24Mi'))) AND
PL.TIME_STAMP < SYSDATE - numtodsinterval ( 30,'MINUTE')
and PL.TIME_STAMP > SYSDATE - numtodsinterval (4,'HOUR')
AND TT.START_DATE < SYSDATE - numtodsinterval ( 30,'MINUTE')
and TT.START_DATE > SYSDATE - numtodsinterval (4,'HOUR')
AND TT.WF_NAME IN
('Subscribe LIDL Community Flat',
'LDLMonatsFlatrate Subscribe');
以上查詢查詢執行計劃:
上表日期字段執行TO_CHAR作爲比較可能抑制指數的使用使用。這樣做的目的是什麼? 「to_char(PT.START_DATE,'YYYYMMDDHH24Mi')= to_char(TT.COMPLETE_DATE,'YYYYMMDDHH24Mi'))」您正在將我認爲已經是表中的DATE類型轉換爲字符。 – OldProgrammer
你好,我現在已經刪除了這些日期條件,但仍然長期運行。實際上,當我計算它返回3000行。 – Andrew