select * from 另给了一个5K个 where not exists (select 1 from A where UID=另给了一个5K个.UID)或者select 另给了一个5K个.* from 另给了一个5K个 left join A on 另给了一个5K个.UID=a.UID where a.UID is null 第一个理论上速度会略快一点儿。
你的SQL语句是什么 EXPLAIN SQL语句
A 5000万级别 B 5k select *from B where not exits (select * from A where B.uid=A.uid)
第一个理论上速度会略快一点儿。
EXPLAIN SQL语句
B 5k
select *from B where not exits (select * from A where B.uid=A.uid)