select a.* from smtopm a INNER JOIN iir b on a.item_key!=b.itm_key上面这句话有什么好的方法使执行时间更短,还有为什么这句话会产生内存溢出.

解决方案 »

  1.   

    select a.* from smtopm a INNER JOIN iir b on a.item_key!=b.itm_key假设a和b表的数据关系是1:1,假设a表有m条数据,b表有n条数据,那么最后就应该有m*(n-1)条数据,楼主希望得到的是这个结果么?
      

  2.   

    != 关系表达式已不能使用索引
    select a.* 
    from smtopm a 
    where not exists (select 1 from iir b where a.item_key = b.itm_key)
      

  3.   

    to beckhambobo(beckham) :
    select a.*
    from smtopm a
    where not exists (select 1 from iir b where a.item_key = b.itm_key)
    这句执行的结果和楼主的
    select a.* from smtopm a INNER JOIN iir b on a.item_key!=b.itm_key
    不一样吧
    楼主这句的结果应该是存在非常多的重复纪录的