Oracle执行计划解析

SQL> create table t (a number);
Table created.
SQL> insert into t values(1); 
1 row created.
SQL>  insert into t values(2);
1 row created.
SQL>  insert into t values(3);
1 row created.
SQL>  insert into t values(4);
1 row created.
SQL>  insert into t values(5);
1 row created.
SQL>  insert into t values(6);
1 row created.
SQL>  insert into t values(7);
1 row created.
SQL>  insert into t values(8);
1 row created.
SQL>  insert into t values(9);
1 row created.
SQL>  insert into t values(10);
1 row created.
SQL> select * from t;
A
----------
1
2
3
4
5
6
7
8
9
10
10 rows selected.
SQL> create index in_t on t(a);
Index created.
SQL> select * from t where a=5;
A
----------
5
SQL> select * from t where a=5;
A
----------
5
SQL> select * from table(dbms_xplan.display_cursor(null,null,'all'));           --查看执行计划
PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID 7kqjutm9tfjyj, child number 0            --SQL_ID是记录SQL语句的标识符
-------------------------------------
select * from t where a=5
Plan hash value: 688619385          -- Plan hash value是生成执行计划解析后的HASH值
------------------------------------------------------------------------- ----------------------------
| Id  | Operation                   | Name      | Rows | Bytes | Cost (%CPU)    | Time |
------------------------------------------------------------------------- ----------------------------
|   0 | SELECT STATEMENT     |         |       |       |     1 (100)  |         |
|*  1 |  INDEX RANGE SCAN    | IN_T     |   1  |  13   |   1   (0)      | 00:00:01 |             --索引范围扫描

PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
   1 - SEL$1 / T@SEL$1
Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access("A"=5)            --ACCESS  改娈数据访问路径。SQL语句走索引了。
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Column Projection Information (identified by operation id):
-----------------------------------------------------------
   1 - "A"[NUMBER,22]
Note
-----
   - dynamic sampling used for this statement (level=2)
32 rows selected.
SQL> 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25854343/viewspace-2143433/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/25854343/viewspace-2143433/

你可能感兴趣的:(Oracle执行计划解析)