谁能把这个sql优化下
select
A.aaID,
A.aaName,
A.aaIP,
D.ddName,
E.eeName,
count(distinct(f.ooID))
from
A
join B on A.bbID=B.bbID
join C on B.ccID=C.ccID
left join D on A.ddID=D.ddID
left join E on A.eeID=E.eeID
left join F on
(F.xxID=A.aaID and F.yyID=1)
or
(exists(select 1 from G where G.aaID=A.aaID and G.ggID=F.xxID) and F.yyID=2)
or
(exists(select 1 from H,G where H.ggID=G.ggID and G.aaID=A.aaID and H.hhID=F.xxID ) and F.yyID=3)
where
C.ccID= ?
group by
A.aaID,
A.aaName,
A.aaIP,
D.ddName,
E.eeName
这个sql执行需要30秒左右
(exists(select 1 from G where G.aaID=A.aaID and G.ggID=F.xxID) and F.yyID=2)这个花的时间较长 大约25秒 G表里有5W条数据
...全文


基础和管理
