How do I get the explain plan oracle?

299    Asked by AashnaSaito in SQL Server , Asked on Jan 31, 2023

Can someone please explain a bit about explain plan, and how does one get the explain plan for a query. Also, if there is any sql script which can be used as a utility for this, that would be great.

To get the explain plan oracle, you can use the package DBMS_XPLAN:
SQL> explain plan for select * from dual;
Explained
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
--------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost |
--------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 2 | 2 |
| 1 | TABLE ACCESS FULL | DUAL | 1 | 2 | 2 |
--------------------------------------------------------------------
Note: cpu costing is off


Your Answer

Interviews

Parent Categories