select t1.id from table1 t1 where tbl1.id not in (select t2.id from table2 t2); t1有9万条数据,t2有3万条数据 使用not exists 代替 not in select t1.id from table1 t1 where not exists (select 1 from table2 t2 where t1.id = t2.id);