我有以下查询,其功能类似于魅力,但是当时表“ci_falsepositives”变满,查询变得非常慢。
有没有人有更好的解决方案来加快速度?感谢...
SELECT * , matches - falsepositives AS hits
FROM (SELECT c.*,
IFNULL( p.total, 0 ) AS matches,
(SELECT COUNT( * )
FROM ci_falsepositives n
WHERE n.addressbook_id = c.reference
AND n.sanction_key IN (SELECT sanction_key
FROM ci_matched_sanctions)) AS falsepositives
FROM ci_address_book c
LEFT JOIN ( SELECT addressbook_id,
COUNT( match_id ) AS total
FROM ci_matched_sanctions
GROUP BY addressbook_id) AS p ON c.id = p.addressbook_id) S
ORDER BY folder asc, lastchecked DESC
LIMIT 0, 15