top of page
  • Writer's pictureArun Kumar

Generate Execution Plan in Oracle

While working on SQL performance tuning, you must know what execution plan optimiser is generating. This execution plan defines how the SQL statement will be executed. There are multiple methods to generate an SQL plan. You can choose the best method that suits you.


AUTOTRACE – easy option


The autotrace option is used when you want to display the sql execution plan on your screen. The only problem with this option is that the sql query will execute first and then display the execution plan.


This might typically be a problem if a SQL statement is taking longer to execute. You need wait until the poor performing sql completes and then will be able to look at the execution plan.

set autotrace on;

select * from emp;


EXPLAIN PLAN


The explain plan method does not require query to execute first. It will display the optimiser execution plan without even executing the sql statement

explain plan for
select * from emp;

Run below to show the explain plan on the screen

SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY());

3,513 views

Recent Posts

See All

Oracle Optimizer determines the cost of each execution plan based on database, schema, table and other statistics. The changes inside database result in stale statistics. As a DBA, you must gather sta

The first step is to understand how instance size is configured. There are two main configurations: One Instance Size Separate SGA and PGA One Instance Size Oracle MEMORY_TARGET parameter defines the

bottom of page