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

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

 

 执行时间如下

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

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

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

 

 

用多表关联更新

 

  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

 

执行时间如下

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

 

 没有更新时候的速度

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

 

相关文章:

  • 2021-09-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-21
  • 2021-12-31
  • 2022-02-07
  • 2023-03-07
猜你喜欢
  • 2021-04-16
  • 2021-12-13
  • 2022-01-10
  • 2022-01-27
相关资源
相似解决方案