我想用在下面的查询我怎么可以这样做NOT EXIST优化我的查询,也请您解释一下它的执行计划优化查询使用NOT EXIST
Select I_Ftn, I_Col, count(c.i_id_num) cnt
From DSCL_ALL.W_CALENDER c
Where c.UNIT_CODE= '01'
AND c.i_g_vill = '45'
and c.i_g_code = '1'
and c.survey_year = '2012-2013'
and c.i_number not in (select m.m_indent from w_mill_pur m where m.unit_code = c.unit_code and m.m_vill = c.i_g_vill and m.m_grow = c.i_g_code)
Group By I_Ftn, I_Col
ORDER BY I_ftn, I_col)
甲骨文是非常聪明的。如果您的陈述会导致与原始执行计划相同的执行计划,我不会感到惊讶。 –
我想这取决于可用索引,但是,Oracle优化器在这方面非常出色。 同时,具有更好的原始查询仍然是一个更好的起点:) – FabienM
呜我以前的查询的执行时间是14.53,现在它正在仅为1秒。谢谢FabienM。 – Ravi