ORACLE数据库有两张表,A表总共有600多条记录,B表有350多条记录,两张表通过left join关联查询,通过SQL Developer工具执行查询都正常,但是使用帆软报表加载数据大约需要15秒左右才能显示数据。 帆软报表中将关联的B表删除,此时报表加载速度就正常,大约1秒左右就加载完成了,查看数据库两张表关联字段都有建立索引了,求大神帮忙分析下看可能是什么问题,谢谢! 下面屏蔽的两行就是B表,只要屏蔽掉就1秒内加载完成,加上就要15秒 select wb.id,wt.typename as 流程分类, --uf.bm as 流程管理部门,uf.fzr as 流程负责人, wb.workflowname as 流程名称,wg.type as 类型,wg.signorder as 会签关系,wg.objid as 对象ID,wg.level_n,wg.level2_n,wg.bhxj as 是否包含下级,wg.jobfield as 岗位对应级别id,hc1.subcompanyname as 岗位指定分部,hd1.departmentname as 岗位指定部门,hc.subcompanyname as 分部,hd.departmentname as 部门,hrj.jobtitlename as 岗位,hrs.rolesmark as 角色,hr.lastname as 人力资源 from workflow_base wb left join workflow_nodelink wn on wn.workflowid=wb.id left join workflow_nodebase wnb on wnb.id=wn.nodeid left join workflow_nodegroup wng on wn.nodeid=wng.nodeid left join workflow_groupdetail wg on wg.groupid=wng.id left join hrmresource hr on hr.id=wg.objid and wg.type=3 left join hrmsubcompany hc on hc.id=wg.objid and wg.type=30 left join hrmdepartment hd on hd.id=wg.objid and wg.type=1 left join hrmsubcompany hc1 on hc1.id = wg.jobfield and wg.type = 58 and wg.level_n = 1 left join hrmdepartment hd1 on hd1.id = wg.jobfield and wg.type = 58 and wg.level_n = 0 left join hrmroles hrs on hrs.id=wg.objid and wg.type=2 left join HrmJobTitles hrj on hrj.id = wg.jobobj and wg.type = 58 left join workflow_type wt on wt.id = wb.workflowtype --left join uf_LCBMFZR uf on uf.lcid = wb.id where wb.isvalid=1 and --流程是否有效判断 wnb.isstart=1 --判断是否创建节点 ${IF(LEN(lcmc)==0,""," and wb.workflowname like '%" + lcmc + "%'")}--流程名称查询 order by wg.id --------------------------------------------- 将屏蔽的表单独建立一个数据集,通过条件过滤来显示,整个报表加载效率提升了,大概5秒左右可以打开报表,查看日志也是uf_lcbmfzr这张表执行的比较慢 |