设为首页 加入收藏

TOP

optimizer_index_caching和optimizer_index_cost_adj两个参数说明(二)
2015-07-24 10:43:35 来源: 作者: 【 】 浏览:4
Tags:optimizer_index_caching optimizer_index_cost_adj 两个参数 说明
----------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 199 | 4179 | 2 (0)| 00:00:18 |
| 1 | TABLE ACCESS BY INDEX ROWID| T | 199 | 4179 | 2 (0)| 00:00:18 |
|* 2 | INDEX RANGE SCAN | T_IDX | 199 | | 1 (0)| 00:00:12 |
-------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("RN"<200)
14 rows selected.

SQL> alter session set optimizer_index_cost_adj=500;
Session altered.
SQL> explain plan for select * from t where rn<200;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 1601196873
-------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 199 | 4179 | 6 (0)| 00:01:10 |
|* 1 | TABLE ACCESS FULL| T | 199 | 4179 | 6 (0)| 00:01:10 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("RN"<200)
13 rows selected.

五、optimizer_index_caching参数示例 IN-LIST示例 SQL> set linesize 200 pagesize 9999
SQL> explain plan for select * from t where rn in (1,2,3,4,5,6,7,100,130,200,240,2000);
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 3506647781
--------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 12 | 252 | 4 (0)| 00:00:43 |
| 1 | INLIST ITERATOR | | | | | |
| 2 | TABLE ACCESS BY INDEX ROWID| T | 12 | 252 | 4 (0)| 00:00:43 |
|* 3 | INDEX RANGE SCAN | T_IDX | 12 | | 3 (0)| 00:00:31 |
--------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
3 - access("RN"=1 OR "RN"=2 OR "RN"=3 OR "RN"=4 OR "RN"=5 OR "RN"=6 OR
"RN"=7 OR "RN"=100 OR "RN"=130 OR "RN"=200 OR "RN"=240 OR "RN"=2000)
16 rows selected.
SQL> alter session set optimizer_index_caching=10;
Session altered.
SQL> explain plan for select * from t where rn in (1,2,3,4,5,6,7,100,130,200,240,2000);

Explained.

SQL> select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------
首页 上一页 1 2 3 4 下一页 尾页 2/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Like关联查询 下一篇如何“玩”微信

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·HyperText Transfer (2025-12-26 07:20:48)
·半小时搞懂 HTTP、HT (2025-12-26 07:20:42)
·CPython是什么?PyPy (2025-12-26 06:50:09)
·Python|如何安装seab (2025-12-26 06:50:06)
·python要学习数据分 (2025-12-26 06:50:03)