20条记录一页,扫描第2页就需要访问40条记录。

SQL> select * from ( select * from ( select /*+ index_desc(a idx_page_3) */ a.*,rownum rn   from page
a where object_id >1000 and owner='SYS' order by object_id desc ) where rownum<=40 ) where
rn>=21 2 3
4 ; SQL> select * from table(dbms_xplan.display_cursor(null,null,'ALLSTATS LAST')); PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------ --------------------------------------------
SQL_ID bwcbf54a6h4th, child number 1
-------------------------------------
select * from ( select * from ( select /*+ index_desc(a idx_page_3) */
a.*,rownum rn from page a where object_id >1000 and owner='SYS'
order by object_id desc ) where rownum<=40 ) where rn>=21 Plan hash value: 3526010999 ---------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers |
---------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | | 20 |00:00:00.01 | 10 |
|* 1 | VIEW | | 1 | 40 | 20 |00:00:00.01 | 10 |
|* 2 | COUNT STOPKEY | | 1 | | 40 |00:00:00.01 | 10 |
| 3 | VIEW | | 1 | 30556 | 40 |00:00:00.01 | 10 |
| 4 | COUNT | | 1 | | 40 |00:00:00.01 | 10 |
| 5 | TABLE ACCESS BY INDEX ROWID | PAGE | 1 | 30556 | 40 |00:00:00.01 | 10 |
|* 6 | INDEX RANGE SCAN DESCENDING| IDX_PAGE_3 | 1 | 30556 | 40 |00:00:00.01 | 4 |
--------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id):
--------------------------------------------------- 1 - filter("RN">=21)
2 - filter(ROWNUM<=40)
6 - access("OBJECT_ID" IS NOT NULL AND "OBJECT_ID">1000 AND "OWNER"='SYS')
filter("OWNER"='SYS') 28 rows selected. SQL> select * from table(dbms_xplan.display_cursor(null,null,'ALLSTATS LAST')); PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------ --------------------------------------------
SQL_ID 6gay6kkxxsqgw, child number 0
-------------------------------------
select * from ( select * from ( select /*+ index_desc(a idx_page_3) */
a.*,rownum rn from page a where object_id >1000 and owner='SYS'
order by object_id desc ) where rownum<=60 ) where rn>=41 Plan hash value: 3526010999 ---------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers |
---------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | | 20 |00:00:00.01 | 11 |
|* 1 | VIEW | | 1 | 60 | 20 |00:00:00.01 | 11 |
|* 2 | COUNT STOPKEY | | 1 | | 60 |00:00:00.01 | 11 |
| 3 | VIEW | | 1 | 30556 | 60 |00:00:00.01 | 11 |
| 4 | COUNT | | 1 | | 60 |00:00:00.01 | 11 |
| 5 | TABLE ACCESS BY INDEX ROWID | PAGE | 1 | 30556 | 60 |00:00:00.01 | 11 |
|* 6 | INDEX RANGE SCAN DESCENDING| IDX_PAGE_3 | 1 | 30556 | 60 |00:00:00.01 | 4 |
--------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id):
--------------------------------------------------- 1 - filter("RN">=41)
2 - filter(ROWNUM<=60)
6 - access("OBJECT_ID" IS NOT NULL AND "OBJECT_ID">1000 AND "OWNER"='SYS')
filter("OWNER"='SYS') 28 rows selected.

分页SQL取下一页的更多相关文章

  1. PHPCMSv9首页显示分页点击下一页跳转链接出现错误,跳转到后台的解决方案

    1 引用页写为 {pc:content action="lists" catid="10" order="updatetime DESC" ...

  2. 【asp.net爬虫】asp.NET分页控件抓取第n页数据 javascript:__doPostBack

    最近在模拟HTTP请求抓取数据,但是服务器是asp.net开发的 分页控件代码 <tr> <td align="left">共&nbsp210&am ...

  3. python实现一个栏目的分页抓取列表页抓取

    python实现一个栏目的分页抓取列表页抓取 #!/usr/bin/env python # coding=utf-8 import requests from bs4 import Beautifu ...

  4. 2016/3/27 分页 共X条数据 本页x条 本页从x-y条 x/y页 首页 上一页 123456 下一页 末页 pagego echo $page->fpage(7,6,5,4,3,2,1,0);

    显示效果: fpage.class.php <?php /** file: page.class.php 完美分页类 Page */ class Page { private $total; / ...

  5. 原生JS实现分页效果2.0(新增了上一页和下一页,添加当前元素样式)

    虽然写的很烂,但至少全部都是自己写的,因为这个没有固定的顺序,所以就没有封装,如果你技术好的话,可以你写的分享给我,谢谢. <!DOCTYPE html><html lang=&qu ...

  6. php按条件查询的数据分页显示,点击下一页时又列出全部数据的解决办法

    其实很简单,只要把表单提交方式改为get方式就行了,然后调用分页函数: function getpage(&$m,$where,$pagesize=10){ $m1=clone $m;//浅复 ...

  7. extjs4 分页工具栏pagingtoolbar的每页显示数据combobox下拉框

    var itemsPerPage = 20; var combo; //创建数据源store Ext.define('recordStore', { extend : 'Ext.data.Store' ...

  8. HTML静态分页(形如:首页,上一页,下一页,尾页)

    在HTML中有时候我们会用到静态分页,一次拿回一定量的数据结果条目,我们会以形如:第2页,共12页  首页 上一页 下一页 尾页 的方式进行静态分页,以下是该种静态分页的代码,供兄弟姐妹们参考. &l ...

  9. 使用selenium webdriver+beautifulsoup+跳转frame,实现模拟点击网页下一页按钮,抓取网页数据

    记录一次快速实现的python爬虫,想要抓取中财网数据引擎的新三板板块下面所有股票的公司档案,网址为http://data.cfi.cn/data_ndkA0A1934A1935A1986A1995. ...

随机推荐

  1. mybatis0208 缓存

    查询缓存 1.1缓存的意义 数据在磁盘会有一个IO,高并发读取效率就很低,将用户经常查询的数据放在缓存(内存)中,用户去查询数据就不用从磁盘上(关系型数据库数据文件)查询,从缓存中查询,从而提高查询效 ...

  2. Qt 学习之路:二进制文件读写

    在上一章中,我们介绍了有关QFile和QFileInfo两个类的使用.我们提到,QIODevice提供了read().readLine()等基本的操作.同时,Qt 还提供了更高一级的操作:用于二进制的 ...

  3. struts2 OGNL 表达式

    一.Struts 2支持以下几种表达式语言: OGNL(Object-Graph Navigation Language),可以方便地操作对象属性的开源表达式语言:JSTL(JSP Standard ...

  4. MAC 环境下 初始化新的mysql root 密码

    mac 环境下初始化mysql的root密码 关掉mysql服务,打开系统设置最后的mysql,然后将mysql先关掉 生成一个文件命名mysql-init,文件中放入:一句话,这句话不同版本不一样, ...

  5. 权限系统与RBAC模型概述

    为了防止无良网站的爬虫抓取文章,特此标识,转载请注明文章出处.LaplaceDemon/SJQ. http://www.cnblogs.com/shijiaqi1066/p/3793894.html ...

  6. HTML5 文件域+FileReader 分段读取文件(四)

    一.分段读取txt文本 HTML: <div class="container"> <div class="panel panel-default&qu ...

  7. eclipse-自动注释

    在eclipse中自动添加'注释'的快捷键是'Alt+Shift+J',可以在 MyEclipse中的 Java->Code Style->Code Template->Commen ...

  8. 常用CDN公共库

    Jquery <script src="http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js"></scrip ...

  9. 输出内容(document.write)

    document.write() 直接在页面中输出内容 第一种 直接输出 document.write("I Love Javascript !") //输出内容为:I Love ...

  10. 百度地图API地址转换成经纬度

    public class LngAndLatUtil { public static Map<String,Double> getLngAndLat(String address){ Ma ...