查询条件索引都加了 Navicat工具查询 速度不到1秒 但是写到程序里就 得用6 7秒 怎么优化
select userName as gsmc,invoice as sh,c.kpjh as kpjh,companyName as cjd,COALESCE(f.SL,0) as SL,COALESCE(f.pp,0) as ppNum,COALESCE(f.zp,0) as zpNum,COALESCE(f.jdcp,0) as jdcNum,COALESCE(f.zje,0) as totalJE,COALESCE(f.zse,0) as totalSE from tb_userinfo c left join (select xfsh,kpjh,count(fphm) as SL, count(if((fpzl='c' or fpzl='t'),true,null)) AS pp,count(if(fpzl='s',true,null)) AS zp,count(if(fpzl='j',true,null)) AS jdcp,COALESCE(SUM(JSHJ),0) as zje,COALESCE(SUM(HJSE),0) as zse from tb_xxfp where 1=1 and zfbz=0 and ssyf = '201712'GROUP BY xfsh, kpjh ) as f on c.invoice = f.XFSH and c.kpjh = f.KPJH where 1=1 order by invoice ,c.kpjh