How to read an Oracle execution plan
The execution plan is how Oracle runs your query: which tables it reads, through which indexes, and how it joins them. Reading it is the first step of every tuning.
Get the plan
EXPLAIN PLAN shows the plan Oracle would choose, without running the query:
explain plan for
select c.name, sum(o.amount)
from customers c
join orders o on o.customer_id = c.customer_id
where o.order_date >= date '2026-01-01'
group by c.name;
select * from table(dbms_xplan.display);To see what really happened, with the actual rows of each step, run the query with a hint and read the plan from the cursor cache:
select /*+ gather_plan_statistics */ ... ;
select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST'));Read it in the right order
- The plan is a tree: a step's children are indented below it. Oracle starts with the most indented steps.
- Of two children, the first one is read first: in a join, it is the driving row source.
- Rows is the optimizer's estimate for the step; Cost is its estimate of the work, comparable only between plans of the same query.
- The Predicate Information under the plan says, per step Id, which conditions are used to find rows (access) and which only filter them (filter).
The operations you will meet
- TABLE ACCESS FULL: reads the whole table. Fine for a small table, or for most of a big one; a warning sign when you want a few rows.
- INDEX UNIQUE SCAN / INDEX RANGE SCAN: finds rows through an index, followed by TABLE ACCESS BY INDEX ROWID to read them.
- NESTED LOOPS: for each row of the first source, looks up the second. Good when the first source returns few rows.
- HASH JOIN: builds a hash table of the smaller source and probes it with the other. Good for joining many rows.
- SORT ORDER BY / SORT GROUP BY / HASH GROUP BY: sorting and grouping, which may spill to temp for large sets.
What to look for
Estimates far from the actual rows (stale statistics, skewed data), a full scan of a large table where an index was expected (often a function or a conversion on the column), and nested loops over many rows. See why is my Oracle query slow for the common causes.
In Felix
Ctrl+E shows the plan of the statement at the caret, in several views, with a full table scan flagged; Ctrl+Alt+E runs Autotrace with its statistics. Optimize with AI (Ctrl+Shift+Q) reads the plan for you, explains what slows the query down, and suggests a rewrite and indexes.
More about it: AI query optimizer for Oracle in Felix.
Try it on your own database
Felix is a Windows IDE for Oracle SQL and PL/SQL, from 11g to 23ai. Every feature is in the free 30-day trial; no account needed.