oracle中rownum效率低的原因以及解决办法
--A低效率
select t.*
from (select *
from GET_ENTER_EXAM_SCORE t
where signupyear = '2013'
and signupseason = '春季') t
where rownum < 100
--B高效率
select t.*
from (select b.*, rownum r
from (select *
from GET_ENTER_EXAM_SCORE a
where signupyear = '2013'
and signupseason = '春季'
order by zkzh) b) t
where r < 100
其中B中要嵌套三层是因为最里面一层用于排序,倒数第二层用于查询排好序的记录并按顺序标记rownum