不导致加载
select p.*
from contacts p left outer join
(select articleno, size, count(*) as cnt
from bsd t
group by articleno, size
) bc
on p.articleno = bc.articleno and p.size = bc.size
where coalesce(cnt, 0) < (select count(*)
from contacts p2
where p2.articleno = p.articleno and
p2.size = p.size and
p2.id <= p.id
);
上面的查询有很多子查询,因此处理速度越来越慢,如果数据量增加,情况会变得更糟,所以最好选择任何其他方式来获取数据,或者您可以使用EXPLAIN来查看实际问题在哪里