下面的查詢運行7小時。任何人都可以幫助我優化查詢?Query Optimitize
select count(1)
FROM temp_raw_appointments trp
left join temp_raw_transactions_sep tra
on case when tra.[rndrng prvdr] in (SELECT [rndrng prvdr]
FROM temp_raw_changetosupprov)
then tra.[sup prvdr]
when tra.[rndrng prvdr] = 'P003_BMI_WidermannJ'
then 'P003_WiedermannJ' -- Kim Chirayil's customization, 06/16
when tra.[rndrng prvdr] = 'P014_HeerenK'
then 'P014_HarrisonL' -- Kim Chirayil's customization, 06/16
else tra.[rndrng prvdr] end
=trp.[appt schdlng prvdr]
where tra.[rndrng prvdr] is null
你的執行計劃是什麼樣的?你可以使用'where not exist'而不是'where null'來幫助你 – dbajtr
什麼是表格的鍵?你有什麼指標在桌子上? –
你可以在這裏粘貼我們的查詢執行計劃嗎? https://www.brentozar.com/pastetheplan/ – Hybris95