SQL查询,而我正在执行选择查询其加载很长一段时间,而不是导致其唯一的加载


sql query while i am excuting select query its loading for long time its not resulting its only loading

不导致加载

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来查看实际问题在哪里