【dbms_xplan.display_cursor包】預設與ADVANCED ALLSTATS LAST PEEKED_BINDS區別
結論1:使用ALL LAST比typical多了Query Block Name / Object Alias和Column Projection Information(列的資訊)
結論2:ADVANCED ALLSTATS LAST PEEKED_BINDS比ALL LAST多了這些內容:outline和NOTE,當然如果使用了繫結變數的話,還有繫結變數資訊
結論3:一般來說ALL LAST就已經夠用了。
使用一個不使用繫結變數的語句來做對比試驗:
select /*weiwei*/ e.ename,d.dname from scott.emp e,scott.dept d where e.deptno=d.deptno;
SQL> SELECT * FROM table (DBMS_XPLAN.DISPLAY_CURSOR);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID 1qwpbwszr5hwb, child number 0
-------------------------------------
select /*weiwei*/ e.ename,d.dname from scott.emp e,scott.dept d where
e.deptno=d.deptno
Plan hash value: 844388907
----------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 6 (100)| |
| 1 | MERGE JOIN | | 14 | 308 | 6 (17)| 00:00:01 |
| 2 | TABLE ACCESS BY INDEX ROWID| DEPT | 4 | 52 | 2 (0)| 00:00:01 |
| 3 | INDEX FULL SCAN | PK_DEPT | 4 | | 1 (0)| 00:00:01 |
|* 4 | SORT JOIN | | 14 | 126 | 4 (25)| 00:00:01 |
| 5 | TABLE ACCESS FULL | EMP | 14 | 126 | 3 (0)| 00:00:01 |
----------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
4 - access("E"."DEPTNO"="D"."DEPTNO")
filter("E"."DEPTNO"="D"."DEPTNO")
24 rows selected.
select sql_id,CHILD_NUMBER,sql_text from v$SQL where sql_text like '%weiwei%' and sql_text not like '%like%';
獲得SQL_id為1qwpbwszr5hwb,CHILD_NUMBER為0
select * from table(dbms_xplan.display_cursor('1qwpbwszr5hwb',null,'ALL LAST'));
SQL> select * from table(dbms_xplan.display_cursor('1qwpbwszr5hwb',null,'ALL LAST'));
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID 1qwpbwszr5hwb, child number 0
-------------------------------------
select /*weiwei*/ e.ename,d.dname from scott.emp e,scott.dept d where
e.deptno=d.deptno
Plan hash value: 844388907
----------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 6 (100)| |
| 1 | MERGE JOIN | | 14 | 308 | 6 (17)| 00:00:01 |
| 2 | TABLE ACCESS BY INDEX ROWID| DEPT | 4 | 52 | 2 (0)| 00:00:01 |
| 3 | INDEX FULL SCAN | PK_DEPT | 4 | | 1 (0)| 00:00:01 |
|* 4 | SORT JOIN | | 14 | 126 | 4 (25)| 00:00:01 |
| 5 | TABLE ACCESS FULL | EMP | 14 | 126 | 3 (0)| 00:00:01 |
----------------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - SEL$1
2 - SEL$1 / D@SEL$1
3 - SEL$1 / D@SEL$1
5 - SEL$1 / E@SEL$1
Predicate Information (identified by operation id):
---------------------------------------------------
4 - access("E"."DEPTNO"="D"."DEPTNO")
filter("E"."DEPTNO"="D"."DEPTNO")
Column Projection Information (identified by operation id):
-----------------------------------------------------------
1 - "D"."DNAME"[VARCHAR2,14], "E"."ENAME"[VARCHAR2,10]
2 - "D"."DEPTNO"[NUMBER,22], "D"."DNAME"[VARCHAR2,14]
3 - "D".ROWID[ROWID,10], "D"."DEPTNO"[NUMBER,22]
4 - (#keys=1) "E"."DEPTNO"[NUMBER,22], "E"."ENAME"[VARCHAR2,10]
5 - "E"."ENAME"[VARCHAR2,10], "E"."DEPTNO"[NUMBER,22]
41 rows selected.
結論1:使用ALL LAST比typical多了Query Block Name / Object Alias和Column Projection Information(列的資訊)
再對比ALL LAST與ADVANCED ALLSTATS LAST PEEKED_BINDS
最後最全的是65行
select * from table(dbms_xplan.display_cursor('1qwpbwszr5hwb',0,'ADVANCED ALLSTATS LAST PEEKED_BINDS'));
SQL> select * from table(dbms_xplan.display_cursor('1qwpbwszr5hwb',0,'ADVANCED ALLSTATS LAST PEEKED_BINDS'));
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID 1qwpbwszr5hwb, child number 0
-------------------------------------
select /*weiwei*/ e.ename,d.dname from scott.emp e,scott.dept d where
e.deptno=d.deptno
Plan hash value: 844388907
--------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | E-Rows |E-Bytes| Cost (%CPU)| E-Time | OMem | 1Mem | Used-Mem |
--------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 6 (100)| | | | |
| 1 | MERGE JOIN | | 14 | 308 | 6 (17)| 00:00:01 | | | |
| 2 | TABLE ACCESS BY INDEX ROWID| DEPT | 4 | 52 | 2 (0)| 00:00:01 | | | |
| 3 | INDEX FULL SCAN | PK_DEPT | 4 | | 1 (0)| 00:00:01 | | | |
|* 4 | SORT JOIN | | 14 | 126 | 4 (25)| 00:00:01 | 2048 | 2048 | 2048 (0)|
| 5 | TABLE ACCESS FULL | EMP | 14 | 126 | 3 (0)| 00:00:01 | | | |
--------------------------------------------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - SEL$1
2 - SEL$1 / D@SEL$1
3 - SEL$1 / D@SEL$1
5 - SEL$1 / E@SEL$1
Outline Data
-------------
/*+
BEGIN_OUTLINE_DATA
IGNORE_OPTIM_EMBEDDED_HINTS
OPTIMIZER_FEATURES_ENABLE('11.2.0.3')
DB_VERSION('11.2.0.3')
OPT_PARAM('query_rewrite_enabled' 'false')
ALL_ROWS
OUTLINE_LEAF(@"SEL$1")
INDEX(@"SEL$1" "D"@"SEL$1" ("DEPT"."DEPTNO"))
FULL(@"SEL$1" "E"@"SEL$1")
LEADING(@"SEL$1" "D"@"SEL$1" "E"@"SEL$1")
USE_MERGE(@"SEL$1" "E"@"SEL$1")
END_OUTLINE_DATA
*/
Predicate Information (identified by operation id):
---------------------------------------------------
4 - access("E"."DEPTNO"="D"."DEPTNO")
filter("E"."DEPTNO"="D"."DEPTNO")
Column Projection Information (identified by operation id):
-----------------------------------------------------------
1 - "D"."DNAME"[VARCHAR2,14], "E"."ENAME"[VARCHAR2,10]
2 - "D"."DEPTNO"[NUMBER,22], "D"."DNAME"[VARCHAR2,14]
3 - "D".ROWID[ROWID,10], "D"."DEPTNO"[NUMBER,22]
4 - (#keys=1) "E"."DEPTNO"[NUMBER,22], "E"."ENAME"[VARCHAR2,10]
5 - "E"."ENAME"[VARCHAR2,10], "E"."DEPTNO"[NUMBER,22]
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
65 rows selected.
結論2:ADVANCED ALLSTATS LAST PEEKED_BINDS比ALL LAST多了這些內容:outline和NOTE,當然如果使用了繫結變數的話,還有繫結變數資訊
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28853590/viewspace-2151177/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【dbms_xplan包】對比試驗之ALL與ADVANCED +PEEKED_BINDS區別
- Last 與 break flag 的區別AST
- E:last-child與E:last-of-type區別AST
- nginx中的break與last指令區別NginxAST
- :last-child與:last-of-type你只是會用,有研究過區別嗎?AST
- ${VAR:=預設值}和${VAR:-預設值} 區別
- jar包和war包的介紹與區別JAR
- jar包、war包和ear包的介紹與區別JAR
- linux原始碼包與RPM包的區別Linux原始碼
- 高仿包與專櫃正品區別
- 區塊鏈錢包開發與型別區塊鏈型別
- 【dbms包】DBMS_ADVANCED_REWRITE
- 預渲染與實時渲染:有什麼區別?
- MySQL中普通sql與預編譯sql 區別MySql編譯
- 高仿包和1:1包區別
- &與&&, |與||區別
- VS 預設安裝包
- 原始碼包和rpm包的區別原始碼
- 概要設計與詳細設計的區別
- 博森量化軟體:託管錢包與非託管錢包的區別?
- USB 包的分類(令牌包這些)與USB 域的區別及關係
- 系統設計與普通設計思考的區別
- 關於mysql設定varchar 欄位的預設值''和null的區別,以及varchar和char的區別MySqlNull
- 碼農與程式設計師的區別程式設計師
- ??與?:的區別
- gucci高仿包和正品區別?
- Python類、模組、包的區別Python
- 正品包和高仿包有什麼區別嗎
- JavaScript建立閉包的兩種方式的優劣與區別分析JavaScript
- 優秀設計師與卓越設計師的區別
- “優秀”設計師與“卓越”設計師的區別
- 架構師與程式設計師的區別架構程式設計師
- 程式設計師與架構師的區別程式設計師架構
- 手機APP與原生APP設計的區別APP
- 型別預設和any型別型別
- Css預編語言以及區別CSS
- 原始型別與包裝類型別
- python 的類 模組 包的區別Python