行欲取導致sqlplus中trace的consistent gets遠大於實際塊數
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Nov 10 15:09:11 2011Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options
SQL> SELECT BYTES/1024/1024 SIZE_MB FROM DBA_SEGMENTS
2 WHERE SEGMENT_NAME='SYS_USER' AND WNER='JESSE';
SIZE_MB
----------
56
SQL> alter system flush buffer_cache;
System altered.
SQL> set autotrace traceonly;
SQL> select * from JESSE.SYS_USER;
253348 rows selected.
Execution Plan
----------------------------------------------------------
Plan hash value: 4234589240
------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 253K| 50M| 1192 (1)| 00:00:17 |
| 1 | TABLE ACCESS FULL| SYS_USER | 253K| 50M| 1192 (1)| 00:00:17 |
------------------------------------------------------------------------------
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
20272 consistent gets
3524 physical reads
0 redo size
31335655 bytes sent via SQL*Net to client
186271 bytes received via SQL*Net from client
16891 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
253348 rows processed
資料庫的db_block_size=16k,表SYS_USER的包含資料塊數=表總大小/db_block_size=56MB/16KB=3584同上面的physical reads基本相等,但consistent gets的數量和我預計的3584相差太大,在這個庫從來不會對SYS_USER表資料做修改,在一致性讀的時候也不會獲取回滾段的資料。
原來遇到過這樣問題沒仔細研究,剛查詢資料發現Tom大師曾經對此做過解答:
sqlplus的欲取行預設是arraysize 15,一次只能查15行,行數/每讀取行數=253348/15(sqlplus中查詢完起碼要讀這麼多資料庫塊,即便是有重復的)+3584=20473和上面consistent gets的數量基本相等了。
再驗證一下,將arraysize盡量設大,看看有變化沒有:
SQL> SET ARRAYSIZE 50000;
SP2-0267: arraysize option 50000 out of range (1 through 5000)
SQL> SET ARRAYSIZE 5000;
SQL> select * from JESSE.SYS_USER;
253348 rows selected.
Execution Plan
----------------------------------------------------------
Plan hash value: 4234589240
------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 253K| 50M| 1192 (1)| 00:00:17 |
| 1 | TABLE ACCESS FULL| SYS_USER | 253K| 50M| 1192 (1)| 00:00:17 |
------------------------------------------------------------------------------
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
3582 consistent gets
0 physical reads
0 redo size
28254118 bytes sent via SQL*Net to client
1042 bytes received via SQL*Net from client
52 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
253348 rows processed
果不其然,看來以後用sqlplus做trace要小心啦。。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25583515/viewspace-710763/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- sqlplus中arrayseize引數以及consistent getsSQL
- 關於執行計劃裡recursive calls,db block gets和consistent gets引數的解釋BloC
- consistent gets
- 關於統計中Consistent Gets,Physical Reads和DB Block Gets的意義BloC
- (轉)關於 db block gets,consistent gets,physical reads的概念BloC
- oracle buffer gets=db block gets+consistent getsOracleBloC
- DB Bocks gets & Consistent gets 區別
- db block gets 與 consistent read getsBloC
- DB Block Gets、Consistent Gets、Physical ReadsBloC
- recursive calls ,db block gets , consistent gets的含義BloC
- consistent gets、db block gets的簡單精闢的理解BloC
- 淺談consistent gets的計算
- 對'Consistent Gets',''Physical Reads'和'DB Block Gets'的理解BloC
- recursive calls, db block gets,consistent gets,physical ReadsBloC
- DB Bocks gets,Consistent gets And Physical reads 轉載
- consistent gets 到底指的是什麼?
- Consistent Gets,Physical Reads和DB Block Gets的解釋(轉)BloC
- oracle實驗記錄 (oracle consistent gets 計算)Oracle
- 對'Consistent Gets',''Physical Reads'和'DB Block Gets'的理解和解釋BloC
- consistent gets暴漲的一種情況
- 【Oracle-記憶體管理】-DB Blocks gets,Consistent gets And Physical readsOracle記憶體BloC
- trace 檔案中 consistent mode與current mode 的解釋
- Consistent Gets(就是logical read)+ DB Block Gets = 所謂的Logical ReadsBloC
- sqlplus註釋導致語句重複執行SQL
- 關於jboss最大執行緒數滿導致服務停止執行緒
- 「日誌」Navicat統計的行數竟然和表實際行數不一致
- selinux導致sqlplus登入失敗LinuxSQL
- 使導致 Aquis 客戶的風險遠低於歐洲其他交易場所UI
- jQuery實現的限制checkbox核取方塊選中的數目jQuery
- 【線上等】關於tomcat最大執行緒數滿導致服務停止Tomcat執行緒
- 環境變數設定錯誤導致sqlplus 連線不上oracle變數SQLOracle
- [20111229]Consistent gets from cache (fastpath).txtAST
- 新的PHP高危漏洞可導致黑客執行遠端程式碼攻擊PHP黑客
- [20111228]理解consistent gets*相關資訊
- JavaScript 限制核取方塊選中數目JavaScript
- 如何啟用sqlplus的auto trace功能(zt)SQL
- JavaScript刪除核取方塊選中的表格行JavaScript
- 一個導致JVM實體記憶體消耗大的BugJVM記憶體