benson458
V2EX  ›  问与答

oracle 如何”更快的“返回指定行数之间的查询结果???

  •  
  •   benson458 · May 10, 2016 · 2465 views
    This topic created in 3658 days ago, the information mentioned may be changed or developed.
    现在只知道用 minus , 

    select ... where rownum < 50 minus select ... where rownum < 30  

    但貌似速度好慢,一亿多条数据的库,每次查 500 条数据出来都要几秒
    2 replies    2016-05-11 14:12:48 +08:00
    wyj12501
        1
    wyj12501  
       May 11, 2016
    select *
    from (select rownum rn, a.*
    from (select * from XXX where YYY order by ZZZ) a
    where rownum < 50)
    where rn > 30;
    benson458
        2
    benson458  
    OP
       May 11, 2016
    @wyj12501 谢谢,不过越读到后面就变得超慢了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   913 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 22:25 · PVG 06:25 · LAX 15:25 · JFK 18:25
    ♥ Do have faith in what you're doing.