mysql update in执行效率优化

来源:互联网 发布:粤贵银手机行情软件 编辑:程序博客网 时间:2024/05/20 11:23

1、常用的mysql执行更新操作语句如下:

UPDATE table1 set num = num + 1 where id in (SELECT id FROM table2 WHERE date>'2017-05-09)

in条件的更新效率可优化使用join语法;
2、join预发更新操作

UPDATE table1 t1 INNER JOIN table2 t2 on t1.id = t2.id set t1.num = t1.num + 1 where t2.date>'2017-05-09'


0 0
原创粉丝点击