Mysql批量更新速度慢的解决方案


批量更新的时候不能用子查询 

update ore set ore_state=0  where shop_orderform_id in( 
        select shop_orderform_id from `shop_orderform` where user_name=xxxxx
         ) 

 

 执行时间如下

即使没有任何更新 也是巨慢

 

 

用多表关联更新

 

  update `ore` o,`shop_orderform` s  set   o.ore_state=0 ,o.get_time='xxxx' 
  where user_name=xxxxxx and s.shop_orderform_id=o.shop_orderform_id

 

执行时间如下

 

 没有更新时候的速度

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM