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

ALiDan 2019-12-16

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);

相关推荐