[20111229]理解consistent gets*相關資訊[補充]
1.補充一點資料:
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for Linux: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
SQL> create table t1 as select rownum id ,'test' name from dual connect by level<=100;
SQL> alter table t1 add constraint pk_t1 PRIMARY KEY(id) USING INDEX(CREATE INDEX i_t1_id ON t1(id,name)) ENABLE ;
SQL> exec dbms_stats.gather_table_stats(ownname=>null, tabname=>'T1', estimate_percent=> null, method_opt=> 'FOR ALL COLUMNS SIZE 1');
SQL> select index_name from user_indexes where table_name='T1';
INDEX_NAME
------------------------------
I_T1_ID
2.
SQL> select b.name,a.value from v$mystat a, v$statname b where a.STATISTIC#=b.STATISTIC# and b.NAME like 'consistent gets%';
NAME VALUE
---------------------------------------------------------------- ----------
consistent gets 51
consistent gets from cache 51
consistent gets - examination 5
consistent gets direct 0
SQL> select id,name from t1 where id=60 ;
ID NAME
---------- ----
60 test
SQL> select b.name,a.value from v$mystat a, v$statname b where a.STATISTIC#=b.STATISTIC# and b.NAME like 'consistent gets%';
NAME VALUE
---------------------------------------------------------------- ----------
consistent gets 53(+2)
consistent gets from cache 53(+2)
consistent gets - examination 5(+0)
consistent gets direct 0
--失望!oracle 看來還是不夠聰明,執行計劃依舊是索引範圍掃描。看來要想實現一個邏輯讀,只能使用IOT表。
SQL> select * from table(dbms_xplan.display_cursor(NULL,NULL,'ALLSTATS LAST'));
PLAN_TABLE_OUTPUT
-------------------------------------
SQL_ID 9r3x00whhy46y, child number 0
-------------------------------------
select id,name from t1 where id=60
Plan hash value: 4406210
---------------------------------------------
| Id | Operation | Name | E-Rows |
---------------------------------------------
|* 1 | INDEX RANGE SCAN| I_T1_ID | 1 |
---------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("ID"=60)
Note
-----
- Warning: basic plan statistics not available. These are only collected when:
* hint 'gather_plan_statistics' is used for the statement or
* parameter 'statistics_level' is set to 'ALL', at session or system level
23 rows selected.
3.在11Gr2下重複測試:
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> select b.name,a.value from v$mystat a, v$statname b where a.STATISTIC#=b.STATISTIC# and b.NAME like 'consistent gets%';
NAME VALUE
---------------------------------------------------------------- ----------
consistent gets 37
consistent gets from cache 37
consistent gets from cache (fastpath) 33
consistent gets - examinatio 4
consistent gets direct 0
SQL> select id,name from t1 where id=60 ;
ID NAME
---------- ----
60 test
SQL> select b.name,a.value from v$mystat a, v$statname b where a.STATISTIC#=b.STATISTIC# and b.NAME like 'consistent gets%';
NAME VALUE
---------------------------------------------------------------- ----------
consistent gets 39(+2)
consistent gets from cache 39(+2)
consistent gets from cache (fastpath) 34(+1)
consistent gets - examination 4(+0)
consistent gets direct 0
--與10g一樣,不過11G增加一個統計資訊consistent gets from cache (fastpath).並且有1個讀,以後研究看看。
補充: 如果執行這樣呢?select id,name from t1 where id=60 and rownum<=1;
SQL> select b.name,a.value from v$mystat a, v$statname b where a.STATISTIC#=b.STATISTIC# and b.NAME like 'consistent gets%';
NAME VALUE
---------------------------------------------------------------- ----------
consistent gets 37
consistent gets from cache 37
consistent gets from cache (fastpath) 33
consistent gets - examination 4
consistent gets direct 0
15:09:28 SQL> select id,name from t1 where id=60 and rownum<=1;
ID NAME
---------- ----
60 test
15:09:54 SQL> select b.name,a.value from v$mystat a, v$statname b where a.STATISTIC#=b.STATISTIC# and b.NAME like 'consistent gets%';
NAME VALUE
---------------------------------------------------------------- ----------
consistent gets 38
consistent gets from cache 38
consistent gets from cache (fastpath) 33
consistent gets - examination 4
consistent gets direct 0
邏輯讀僅僅為1,不過一般情況下不會這樣寫。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-714117/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20111228]理解consistent gets*相關資訊
- [20111229]Consistent gets from cache (fastpath).txtAST
- consistent gets
- 對'Consistent Gets',''Physical Reads'和'DB Block Gets'的理解BloC
- consistent gets、db block gets的簡單精闢的理解BloC
- oracle buffer gets=db block gets+consistent getsOracleBloC
- 對'Consistent Gets',''Physical Reads'和'DB Block Gets'的理解和解釋BloC
- DB Bocks gets & Consistent gets 區別
- (轉)關於 db block gets,consistent gets,physical reads的概念BloC
- db block gets 與 consistent read getsBloC
- DB Block Gets、Consistent Gets、Physical ReadsBloC
- recursive calls, db block gets,consistent gets,physical ReadsBloC
- recursive calls ,db block gets , consistent gets的含義BloC
- DB Bocks gets,Consistent gets And Physical reads 轉載
- consistent gets 到底指的是什麼?
- 關於統計中Consistent Gets,Physical Reads和DB Block Gets的意義BloC
- 淺談consistent gets的計算
- Consistent Gets,Physical Reads和DB Block Gets的解釋(轉)BloC
- 關於執行計劃裡recursive calls,db block gets和consistent gets引數的解釋BloC
- 關於oracle補充日誌作用的理解Oracle
- 【Oracle-記憶體管理】-DB Blocks gets,Consistent gets And Physical readsOracle記憶體BloC
- 原碼反碼補碼的相關理解
- python之執行緒相關操作(補充)Python執行緒
- linux硬體相關的命令(待補充)Linux
- consistent gets暴漲的一種情況
- Elasticsearch 學習總結 - 相關配置補充說明Elasticsearch
- sqlplus中arrayseize引數以及consistent getsSQL
- oracle實驗記錄 (oracle consistent gets 計算)Oracle
- Consistent Gets(就是logical read)+ DB Block Gets = 所謂的Logical ReadsBloC
- C語言關於指標,gets()和gets_s()函式的理解C語言指標函式
- 關於Oracle LOGMNR找不到dml操作及補充日誌相關Oracle
- GlusterFS分散式儲存叢集部署記錄-相關補充分散式
- 有關元件的補充~~~~~~~元件
- hadoop配置檔案詳解、安裝及相關操作補充版Hadoop
- [20190329]探究sql語句相關mutexes補充2.txtSQLMutex
- 『現學現忘』Docker相關概念 — 3、IaaS、SaaS、PaaS服務模式補充Docker模式
- 課時7.其它知識補充(理解)
- 關於switchover的流程和補充