我有一个慢查询
select * from table1 where id NOT IN ( select id from table2 )
这样做会更快吗(不确定是否可行):
select * from table1 where id not in ( select id from table2 where id = table1.id )
或者:
select * from table1 where table1.id NOT EXIST( select id from table2 where table2.id = table1.id )
或者:
select * from table1
left join table2 on table2.id = table1.id
WHERE table2.id is null
还是做其他事情?比如将其拆分为两个查询...