Explain plan

There are two different methods you can use to look at the execution plan of a SQL statement:

  1. EXPLAIN PLAN command – This displays an execution plan for a SQL statement without executing the statement.
  2. V$SQL_PLAN – A dictionary view that shows the execution plan for a SQL statement that has been compiled into a cursor in the cursor cache.

Under certain conditions the plan shown when using EXPLAIN PLAN can be different from the plan shown using V$SQL_PLAN. For example, when the SQL statement contains bind variables the plan shown from using EXPLAIN PLAN ignores the bind variable values while the plan shown in V$SQL_PLAN takes the bind variable values into account in the plan generation process.