当前位置:首页 > 数据库 > 正文

SQL语句效率优化--持续更新

2020-02-13 数据库

1 delete与in搭配使用,效率特别低,如下可解决该问题,not in同理

/*正常写法*/ DELETE from activity where id in ( SELECT id from activity_data); /*优化后写法*/ DELETE from activity where id in (select * from (SELECT id from activity_data) t);

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/SQL/15861.html