There are three ways to check the execution plan:
1) Using Cursor
2) Using AWR
3) Using explain plan set <sql>
1) Using Cursor:
============
Query:
=====
set lines 300 pages 300
select * from table(dbms_xplan.display_cursor('&sql_id'))
/
1) Using Cursor
2) Using AWR
3) Using explain plan set <sql>
1) Using Cursor:
============
Query:
=====
set lines 300 pages 300
select * from table(dbms_xplan.display_cursor('&sql_id'))
/
Input: SQL_ID
Output:
======
Plan hash value: 1357081020
----------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 3 (100)| |
| 1 | TABLE ACCESS STORAGE FULL| TEST | 5 | 175 | 3 (0)| 00:00:01 |
----------------------------------------------------------------------------------
Note
-----
- dynamic sampling used for this statement (level=2)
2) Using AWR:
Query:
======
set lines 300 pages 3000
select * from table(dbms_xplan.display_awr('&sql_id'))
/
Input: SQL_ID
Output:
=======
Plan hash value: 1357081020
----------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 3 (100)| |
| 1 | TABLE ACCESS STORAGE FULL| TEST | 5 | 175 | 3 (0)| 00:00:01 |
----------------------------------------------------------------------------------
Note
-----
- dynamic sampling used for this statement (level=2)
3) Using explain plan set <sql> :
========================
Query:
======
SQL> explain plan for select * from test;
Explained.
SQL> select * from table(dbms_xplan.display);
Output:
=======
PLAN_TABLE_OUTPUT
-------------------
Plan hash value: 1357081020
----------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 5 | 175 | 3 (0)| 00:00:01 |
| 1 | TABLE ACCESS STORAGE FULL| TEST | 5 | 175 | 3 (0)| 00:00:01 |
----------------------------------------------------------------------------------
Note
-----
- dynamic sampling used for this statement (level=2)

No comments:
Post a Comment