论坛首页 入门技术论坛

oracle 分页笔记

浏览 1804 次
该帖已经被评为新手帖
作者 正文
   发表时间:2008-09-02  
    
       -- 注: export_book 表中有21000万条数据。
        --  以下是我的oracle 分页验证 ,查询速度应该是很快了 。 主要是因为建索引的缘故
         --。如果没有索引,数据将变的很慢。越往后查越费时间,多建索引就行了
        
          select *  from (    select  a.* , rownum rownum_ from (  select *  from export_book ) a  
          ) b  where b.rownum_ >=10 and   b.rownum_ <= 20
           --耗时 0.922 秒
          select *  from (    select  a.* , rownum rownum_ from (  select *  from export_book ) a
           ) b  where b.rownum_ >=10000 and   b.rownum_ <= 10010
           --耗时 0.844 秒
           select *  from (    select  a.* , rownum rownum_ from (  select *  from export_book ) a
           ) b  where b.rownum_ >=20000 and   b.rownum_ <= 20010
           --耗时 0.89 秒
   发表时间:2009-05-19  
怎么建得索引呢?分享一下办法啊...
0 请登录后投票
   发表时间:2009-05-19  
    多建索引不一定是好事.

  索引有分类,不同的索引的建立对操作数据会有影响.
体现在于增加和删除数据,如果索引太多,增删效率会很低的,lz可能进行测试和google下.
0 请登录后投票
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics