1、大数据分页查询,varchar 等大字段懒加载
通常代码:
SELECT aj.N_BH, aj.C_AM, aj.C_AH FROM t_aj AS aj ORDER BY aj.D_LARQ DESC LIMIT 100, 10
?10W 条数据,查询时间大约 ?0.73s
?
优化后:
select aj.C_AM, aj.C_AH, aj.N_BH FROM ( SELECT aj.N_BH, aj.D_LARQ FROM t_aj AS aj ORDER BY aj.D_LARQ DESC LIMIT 100, 10 ) T inner join t_aj aj on t.N_BH = aj.N_BH
?10W 条数据,查询时间大约 ?0.17s
?