function display(table_name varchar2 default 'PLAN_TABLE',
statement_id varchar2 default null,
format varchar2 default 'TYPICAL',
filter_preds varchar2 default null
)
SQL>select * from table(dbms_xplan.display('plan_table',null,'basic'));
PLAN_TABLE_OUTPUT
----------------------------------------------------------
Plan hash value: 2521935493
------------------------------------
| Id | Operation | Name |
------------------------------------
| 0 | SELECT STATEMENT | |
| 1 | TABLE ACCESS FULL| T_PLAN |
------------------------------------
8 개의 행이 선택되었습니다.
경 과: 00:00:00.04
SQL>select * from table(dbms_xplan.display('plan_table',null,'typical'));
PLAN_TABLE_OUTPUT
------------------------------------------------------------------
Plan hash value: 2521935493
----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 10000 | 90000 | 8 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T_PLAN | 10000 | 90000 | 8 (0)| 00:00:01 |
----------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("COL1"='Many1')
13 개의 행이 선택되었습니다.
경 과: 00:00:00.06
SQL>set autotrace traceonly
SQL>
SQL>select col1, col2 from t_plan where col1 = 'Many1';
10000 개의 행이 선택되었습니다.
경 과: 00:00:00.28
Execution Plan
----------------------------------------------------------
Plan hash value: 2521935493
----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 10000 | 90000 | 8 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T_PLAN | 10000 | 90000 | 8 (0)| 00:00:01 |
----------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("COL1"='Many1')
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
711 consistent gets
0 physical reads
0 redo size
174886 bytes sent via SQL*Net to client
7726 bytes received via SQL*Net from client
668 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
10000 rows processed
SQL>
SQL>set autotrace off
SQL>select * from table(dbms_xplan.display('plan_table',null,'all'));
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
Plan hash value: 2991289126
--------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 33 | 2 (0)| 00:00:01 |
|* 1 | VIEW | | 1 | 33 | 2 (0)| 00:00:01 |
| 2 | COUNT | | | | | |
| 3 | TABLE ACCESS BY INDEX ROWID| T_PLAN | 1 | 9 | 2 (0)| 00:00:01 |
|* 4 | INDEX RANGE SCAN | T_PLAN_IDX | 1 | | 1 (0)| 00:00:01 |
--------------------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - SUB / from$_subquery$_001@MAIN
2 - SUB
3 - SUB / T_PLAN@SUB
4 - SUB / T_PLAN@SUB
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("COL2"<=200)
4 - access("COL1"='Many2')
Column Projection Information (identified by operation id):
-----------------------------------------------------------
1 - "from$_subquery$_001"."COL1"[VARCHAR2,10], "COL2"[NUMBER,22],
"from$_subquery$_001"."RN"[NUMBER,22]
2 - "COL1"[VARCHAR2,10], "COL2"[NUMBER,22], ROWNUM[4]
3 - "COL1"[VARCHAR2,10], "COL2"[NUMBER,22]
4 - "T_PLAN".ROWID[ROWID,10], "COL1"[VARCHAR2,10]
34 개의 행이 선택되었습니다.
경 과: 00:00:00.20
SQL>
SQL>select * from table(dbms_xplan.display('plan_table',null,'outline'));
PLAN_TABLE_OUTPUT
---------------------------------------------------------------------------
Plan hash value: 2521935493
----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 10000 | 90000 | 8 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T_PLAN | 10000 | 90000 | 8 (0)| 00:00:01 |
----------------------------------------------------------------------------
Outline Data
-------------
/*+
BEGIN_OUTLINE_DATA
FULL(@"SEL$1" "T_PLAN"@"SEL$1")
OUTLINE_LEAF(@"SEL$1")
OPTIMIZER_FEATURES_ENABLE('10.2.0.3')
IGNORE_OPTIM_EMBEDDED_HINTS
END_OUTLINE_DATA
*/
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("COL1"='Many1')
25 개의 행이 선택되었습니다.
경 과: 00:00:00.82
SQL>select * from table(dbms_xplan.display('plan_table',null,'advanced'));
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------
Plan hash value: 2521935493
----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 10000 | 90000 | 8 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T_PLAN | 10000 | 90000 | 8 (0)| 00:00:01 |
----------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - SEL$1 / T_PLAN@SEL$1
Outline Data
-------------
/*+
BEGIN_OUTLINE_DATA
FULL(@"SEL$1" "T_PLAN"@"SEL$1")
OUTLINE_LEAF(@"SEL$1")
OPTIMIZER_FEATURES_ENABLE('10.2.0.3')
IGNORE_OPTIM_EMBEDDED_HINTS
END_OUTLINE_DATA
*/
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("COL1"='Many1')
Column Projection Information (identified by operation id):
-----------------------------------------------------------
1 - "COL1"[VARCHAR2,10], "COL2"[NUMBER,22]
35 개의 행이 선택되었습니다.
경 과: 00:00:00.14
- 강좌 URL : http://www.gurubee.net/lecture/3851
- 구루비 강좌는 개인의 학습용으로만 사용 할 수 있으며, 다른 웹 페이지에 게재할 경우에는 출처를 꼭 밝혀 주시면 고맙겠습니다.~^^
- 구루비 강좌는 서비스 제공을 위한 목적이나, 학원 홍보, 수익을 얻기 위한 용도로 사용 할 수 없습니다.