语句没有什么可以优化的了
建议在inm_trans.use_direction 和 pds_item.note上面分别创建索引

解决方案 »

  1.   

    我曾记得一个高手帮我写过一个,可惜忘记了。就是在SQL上优化的。有没有能提个好方法。
      

  2.   

    没有好办法
    where t.use_direct is null
    必然引起t表的全表扫描
      

  3.   

    update inm_trans t
       set t.use_direct = 
       (
        select NVL(w.item_no , 'xxx')
         from pds_item w
         where w.note=t.use_direction
       )
     where t.use_direct is null上面的SQL是没有任何问题的.
    如果t表很多的话:
     就是select * from inm_trans t where t.use_direct is null
     都很慢.
    那只有加其他条件,
    或者看看use_direct 是否是索引.