sql优化之not in时间:2023-03-09 03:54:58 sql : select ID from awhere XX <> 0 and ID not in (select ID from b) 4万多条记录,执行了316秒,无法接受。 优化为: select a.ID from a where not exists (select b.ID from b where a.ID = b.ID) and a.XX <> 0 只需0.2秒。