分頁查詢,CBO評估的行數有誤。
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SELECT /*+ gather_plan_statistics */ OBJECT_ID, OBJECT_NAME
FROM
(
SELECT ROWNUM RN, OBJECT_ID, OBJECT_NAME
FROM
(
SELECT OBJECT_ID, OBJECT_NAME FROM T ORDER BY OBJECT_NAME
)
WHERE ROWNUM <= 3000
)
WHERE RN >= 2990
SQL> select * from table(dbms_xplan.display_cursor(null,null,'iostats'));
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------
----------------------------
SQL_ID gtm8xfbtqdwac, child number 0
-------------------------------------
SELECT /*+ gather_plan_statistics */ OBJECT_ID, OBJECT_NAME FROM ( SELECT ROWNUM
RN, OBJECT_ID, OBJECT_NAME FROM ( SELECT OBJECT_ID, OBJECT_NAME FROM T ORDER BY
OBJECT_NAME ) WHERE ROWNUM <= 3000 ) WHERE RN >= 2990
Plan hash value: 882605040
-------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers |
-------------------------------------------------------------------------------------------
|* 1 | VIEW | | 1 | 3000 | 11 |00:00:00.02 | 696 |
|* 2 | COUNT STOPKEY | | 1 | | 3000 |00:00:00.03 | 696 |
| 3 | VIEW | | 1 | 50325 | 3000 |00:00:00.03 | 696 |
|* 4 | SORT ORDER BY STOPKEY| | 1 | 50325 | 3000 |00:00:00.03 | 696 |
| 5 | TABLE ACCESS FULL | T | 1 | 50325 | 50325 |00:00:00.05 | 696 |
-------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("RN">=2990)
2 - filter(ROWNUM<=3000)
4 - filter(ROWNUM<=3000)
看ID=4的A-ROWS ,E-ROWS。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22034023/viewspace-671978/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 使用Mybatis-plus進行分頁查詢,沒有分頁效果,查詢的資料量超出每頁數量設定MyBatis
- 有關Oracle分頁查詢語句Oracle
- MySQL的分頁查詢MySql
- Oracle的分頁查詢Oracle
- Lucene的分頁查詢
- Elasticsearch 分頁查詢Elasticsearch
- ssh 分頁查詢
- oracle分頁查詢Oracle
- 分庫分表後的分頁查詢
- 繫結變數,組合查詢方式,導致CBO錯誤一例變數
- ThinkPhp框架:分頁查詢PHP框架
- 分頁查詢優化優化
- NET 集合分頁查詢
- MySQL 多表查詢分頁MySql
- 分頁查詢重構
- Oracle分頁查詢格式Oracle
- SSH框架下的分頁查詢框架
- ssh框架中的分頁查詢框架
- 分頁查詢的排序問題排序
- hibernate 通用分頁,查詢分頁的泛型類泛型
- mysql資料庫查詢時用到的分頁方法有哪些MySql資料庫
- elasticsearch查詢之大資料集分頁查詢Elasticsearch大資料
- 分頁及查詢引數傳遞問題分享
- indexdb實現分頁查詢Index
- AntDesignBlazor示例——分頁查詢Blazor
- MySQL分頁查詢優化MySql優化
- Oracle分頁查詢格式(十三)Oracle
- Oracle分頁查詢格式(十二)Oracle
- Oracle分頁查詢格式(十一)Oracle
- Oracle分頁查詢格式(八)Oracle
- Oracle分頁查詢格式(九)Oracle
- Oracle分頁查詢格式(十)Oracle
- oracle分頁查詢語句Oracle
- Oracle分頁查詢之order byOracle
- oracle sql分頁查詢(一)OracleSQL
- 分頁查詢初接觸
- 關於批次分頁查詢
- 批次分頁查詢問題?