mysql 更新 10W条记录速度很慢

今天  遇到了个问题    update  table1 t  set t.column1 =0 where t.id in (select id from table2)  

    就是要更新的数据大概 有10W多条  然后 我执行了下 结果 2个小时了 还是没 执行成功,  后来 问了个 厉害的小伙伴   

    他把sql 改成了   update table1 t ,table2 b set t.column1=0 where t.id=b.id  

   几秒钟就执行成功  !!! 特此记录下来

猜你喜欢

转载自blog.csdn.net/QAQ_666666/article/details/78896221