You can generate an explain plan using :
SQL> EXPLAIN PLAN FOR 2 SELECT * 3 FROM emp 4 WHERE mgr = 7902 5 /
… and read the plan back using:
SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY) 2 / PLAN_TABLE_OUTPUT -------------------------------------------------------------------- -------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost | -------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 2 | 74 | 2 | |* 1 | TABLE ACCESS FULL | EMP | 2 | 74 | 2 | -------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- PLAN_TABLE_OUTPUT -------------------------------------------------------------------- 1 - filter("EMP"."MGR"=7902) Note: cpu costing is off 14 rows selected.
However, what this actually means is “I’m going to drive from A to B and this is the route I’ll take”. What happens when you set off to drive and the traffic is bad, or you encounter an accident? Well, of course, your plan changed and you go by another route.
What that means is it’s better to see what plan was executed, rather than what was intended:
select * from table (dbms_xplan.display_cursor(format=>’allstats last’));