===== DB2 ======
1.创建索引
create index 索引名 on 表名( 排序用的列名 ASC)
2.更新统计信息
runstats on table 模式名.表名 with distribution and on all columns and detailed index 模式名.索引
3.优化SQL
SELECT * FROM (Select 字段1,字段2,字段3,rownumber() over(ORDER BY 排序用的列名 ASC) AS rn from 表名 ORDER BY 排序用的列名 ASC fetch first 20 rows only) AS a1 WHERE a1.rn BETWEEN 10 AND 20