select * fr om bsinfouser. infobase wh ere id in(select id from (select id,ro wnum n from bsinfouser.infobase ) whe re n<=3450 and n>=21)select * from (select a.*,rownum n from bs infouser.infobase a) where n<=3450 and n>=21分页用的,哪个好,大家讨论一下,

解决方案 »

  1.   

    谢谢,要,在后面加一个 order by id desc.
      

  2.   

    我觉得只要是要全表取都不是最理想的,速度都快不到哪去。
    直接把页数算好了
    select * from bsinfouser. infobase where  n <=num1 and n>=num2 不就行了?
      

  3.   

    对,应该在,select * fr om bsinfouser. infobase wh ere id in(select id from (select id,ro wnum n from bsinfouser.infobase order by id desc) whe re n <=3450 and n>=21) 
    谢谢 vc555 提醒buffalodong326 你那句应该语法上有错误吧!
      

  4.   

    二个原则:
    1.使用stopkey
    2.先在索引分页,然后再回表。
      

  5.   

    我觉得只要是要全表取都不是最理想的,速度都快不到哪去。 
    直接把页数算好了 
    select * from bsinfouser. infobase where  rownum <=num1 
    minus
    select * from bsinfouser. infobase where  rownum <num2
    不就行了? 
    而且我试过这样似乎比之前极为给出的写法速度更快一些如果大数据量