NutzCN Logo
问答 dao.execute 查询耗时问题
发布于 2541天前 作者 mrwangzh 2054 次浏览 复制 上一个帖子 下一个帖子
标签:

查询条件索引都加了 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 
14 回复

数据量多少, navicat是否把全部数据都显示了?

这样写有问题没 ?

	ss = Sqls.queryRecord(sql); 
			ss.setCallback(Sqls.callback.entities());
			Entity<XXFP> e = dao.getEntity(XXFP.class);
			ss.setEntity(e);
			dao.execute(ss);
			List<XXFP> listdy = ss.getList(XXFP.class);

结果集有多少数据?

去掉setCallback, getList会返回null, 只为了看耗时.

额。。 摘掉以后只要9毫秒 那我要怎么改 是直接返回一个map吗

试一下maps回调,另外,什么版本的nutz呢?

sql.setCallback(Sqls.callback.records());和sql.setCallback(Sqls.callback.maps()); 就字段大小写的区别是把
如果是maps的话 sql.getList(这里应该写的是java.util.Map吗.class);??

速度怎样??

稍等 我把代码改一遍再测试一下

添加回复
请先登陆
回到顶部