此sql能否优化,view_zy_detail_charge_b 中146多万行数据, yb_yinghai_zy_mx 91万多行
优化一下,不使用not exists,请高手指点select * from view_zy_detail_charge_b a
where inpatient_no = '2011102166'
and admiss_times = 3
and not exists (select 1 from yb_yinghai_zy_mx b where a.detail_sn = b.yka105)
优化一下,不使用not exists,请高手指点select * from view_zy_detail_charge_b a
where inpatient_no = '2011102166'
and admiss_times = 3
and not exists (select 1 from yb_yinghai_zy_mx b where a.detail_sn = b.yka105)
where inpatient_no = '2011102166'
and admiss_times = 3
and not exists (select 1 from yb_yinghai_zy_mx b where a.detail_sn = b.yka105)你这段语句与外表没啥关系啊。
只要后面这个表查不到就直接返回前面的数据。优化的就是看你条件的索引
yb_yinghai_zy_mx 的索引是yka105
排索引第几位?