使用JFinal+Oracle开发,发现带有order by的查询语句效率很慢,如下:
SELECT *
FROM (SELECT ROW_.*, ROWNUM ROWNUM_
FROM (SELECT *
FROM V_KA02
WHERE AKE020 = '100160'
ORDER BY AKA232 DESC) ROW_
WHERE ROWNUM <= 20) TABLE_ALIAS
WHERE TABLE_ALIAS.ROWNUM_ > 0
如果把ORDER BY AKA232 DESC放到外面来,查询速度就会很快了。在JF中,这个查询语句是固定好了的,请问如何优化这种分页查询?
SELECT *
FROM (SELECT ROW_.*, ROWNUM ROWNUM_
FROM (SELECT *
FROM V_KA02
WHERE AKE020 = '100160'
) ROW_
WHERE ROWNUM <= 20 ORDER BY AKA232 DESC) TABLE_ALIAS
WHERE TABLE_ALIAS.ROWNUM_ > 0
项目:JFinal
按理说这个不会影响性能