我的报表使用了行式引擎,数据集相对复杂,打开和切换下一页报表时还是很慢,为什么呢? 我理解的行式引擎报表的使用场景有错误吗? http://help.finereport.com/doc-view-997.html 行引擎报表:边取数边执行报表,执行到哪页用户就可以看到哪页,用户访问到看到结果的时间=首页数据读取时间+首页计算时间。 SQL: select * from ( SELECT a.id, CASE WHEN a.client_name = '' OR a.client_name IS NULL THEN '--' ELSE a.client_name END AS '客户姓名', CASE WHEN a.card_id = '' OR a.card_id IS NULL THEN '--' ELSE a.card_id END as '证件号码', CASE WHEN a.mobile = '' OR a.mobile IS NULL THEN '--' ELSE a.mobile END as '移动电话', CASE WHEN a.client_type = 0 THEN '意向客户' ELSE '投资客户' END AS '客户类型', CASE WHEN a.register_time = 0 OR a.register_time IS NULL THEN '--' ELSE FROM_UNIXTIME(a.register_time) END as '注册时间', CASE WHEN a.auth_time = 0 OR a.auth_time IS NULL THEN '--' ELSE FROM_UNIXTIME(a.auth_time) END as '认证时间', CASE WHEN a.first_submit_time = 0 OR a.first_submit_time IS NULL THEN '--' ELSE FROM_UNIXTIME(a.first_submit_time) END as '首投时间', CASE WHEN b.realname = '' OR b.realname IS NULL THEN '--' ELSE b.realname END as '顾问姓名', CASE WHEN b.card_id = '' OR b.card_id IS NULL THEN '--' ELSE b.card_id END as '顾问证件号码', a.create_time as '创建时间',e.code, CASE WHEN a.org_id > 0 and e.dr != 1 THEN (select GROUP_CONCAT(`name` ORDER BY `code`) from organization where e.`code` like concat(`code`,'%')) ELSE '--' END as '组织架构' FROM client_base_info as a LEFT JOIN admin as b ON a.admin_id = b.id LEFT JOIN organization as e ON a.org_id = e.id WHERE a.dr != 1 ) x ---------------------------------------------------- 使用到的3个数据表记录数分别为: select count(1) as 记录数 from client_base_info -- 47万条 select count(1) as 记录数 from admin -- 26696条 select count(1) as 记录数 from organization -- 12553条 ----------------------------------------------------- 4个关联字段上都有索引: LEFT JOIN admin as b ON a.admin_id = b.id LEFT JOIN organization as e ON a.org_id = e.id 编辑于 2018-9-5 14:36 |