我有以下查询,这两个表都很大。查询非常慢,我需要您的想法来优化此查询,或者您有其他解决方案吗?
SELECT c.EstablishmentID,
(SELECT COUNT(ID)
FROM cleanpoi
WHERE EstablishmentID=c.EstablishmentID OR EstablishmentID
IN (SELECT ChildEstablishmentID
FROM crawlerchildren
WHERE ParentEstablishmentID=c.EstablishmentID)
) POI
FROM crawler c
GROUP BY c.EstablishmentID
顺便说一句,我应用了适当的索引。
更新:
好的,我已经附上了解释结果。