1.由于delete语句删除数据时候,速度较慢
初始做法 delete from A where id in(select user_id from B);
其实 A表和B表之间有关联的
优化之后的做法是
delete a from A a inner join B b
on a.id = b.user_id
where b.team = ?
优化之后的做法执行效率很高
时间: 2024-11-20 07:05:55
1.由于delete语句删除数据时候,速度较慢
初始做法 delete from A where id in(select user_id from B);
其实 A表和B表之间有关联的
优化之后的做法是
delete a from A a inner join B b
on a.id = b.user_id
where b.team = ?
优化之后的做法执行效率很高