Why is the Explain Plan results in SGA Trace different than in the Editor?
The Explain Plan command is not a guarantee of the exact plan that Oracle will use when the query is actually run. It's Oracle's best guess. When the query is actually executed, the values of bind variables, and other factors, may affect the actual execution plan.
When we are in the Editor, we always use the explain plan command. Toad does not look for your query in Oracle's cache.
When we are looking in SGA Trace (or Session Browser, or anywhere that shows queries already executed), since the query has already been executed, we can look in v$sql_plan to see the plan that was actually used when the query was executed. If for some reason the plan for the query is not found in v$sql_plan (sometimes they get aged out or invalidated), THEN we will do an explain plan command from that screen.
If a new explain plan command was generated, it will say "New Explain Plan" right above the explain plan display. If we found the plan in v$sql_plan, then it will say "Cached Explain Plan" right above the explain plan display.
© ALL RIGHTS RESERVED. Feedback Terms of Use Privacy Cookie Preference Center