各位大虾:在执行这条语句的时候挺快:select qf_ivr_old.mobile from qf_ivr,qf_ivr_old where qf_ivr.mobile=qf_ivr_old.mobile但一执行删除时候:
delete qf_ivr where mobile in(select qf_ivr_old.mobile from qf_ivr,qf_ivr_old where qf_ivr.mobile=qf_ivr_old.mobile)比较慢,各位有什么好的方法,优化一下,谢谢

解决方案 »

  1.   

    delete qf_ivr where exists (select qf_ivr_old.mobile from qf_ivr_old where qf_ivr.mobile=qf_ivr_old.mobile)
      

  2.   

    delete qf_ivr where mobile in(select qf_ivr_old.mobile from qf_ivr,qf_ivr_old where qf_ivr.mobile=qf_ivr_old.mobile)add index on qf_ivr.mobile,qf_ivr_old.mobile respectively
      

  3.   

    多谢两位的支持,不过kulama2004(kulama) 的这种方法,我已经用了,也是很慢,我两个表的mobile都建索引了
      

  4.   

    表大吗?查询的时候使用到了索引了吗?自己看看执行计划。
    select qf_ivr_old.mobile from qf_ivr,qf_ivr_old where qf_ivr.mobile=qf_ivr_old.mobile有多少数据量select count(*) from qf_ivr 有多少数据量。索引是什么?