What’s the best way to display the execution plan for an Oracle SQL statement?
A common method is EXPLAIN PLAN command followed by DBMS_XPLAN.DISPLAY to format and view the plan. But keep in mind that EXPLAIN PLAN parses your query to create the predicted plan on the current server. There are several reasons the predicted plan is not the same as the actual plan. For example, if you’re not testing on your production server (and who is!) the actual plan could be different. To get the actual plan used, consider DBMS_XPLAN.DISPLAY_CURSOR or DBMS_XPLAN.DISPLAY_AWR. For more information, we recommend studying the DBMS_XPLAN package in the Oracle PL/SQL Packages Reference doc.