日期:2014-05-18  浏览次数:20568 次

此sql能否优化,100多万行数据
此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)

------解决方案--------------------
view_zy_detail_charge_b是视图?

最好把视图代码拆分出来,把where子句条件加进去.
------解决方案--------------------
探讨
引用:

引用:
引用:

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.de……