by Markus Winand.

Getting an Execution Plan


There are two ways to obtain an execution plan:

SET PLANONLY ON

You can put the current database session into plan-only mode by issuing this command:

SET PLANONLY ON

Every sub sequentially executed command will just return it's execution plan rather than being executed. This is the better approach to obtain an execution plan because the output is more verbose.

Of course, you can disable plan-only mode again by setting it to OFF.

The execution plan shown by plan-only is also stored in SYSADM.PLAN_TABLE. Note that you need to disable plan-only before selecting from PLAN_TABLE—otherwise you just plan the query on PLAN_TABLE.

Session → Execution Plan / Tree-Button

After actually running a query you can obtain it's execution plan via the menu SessionExecution Plan or by pushing the "Tree-Icon" in the toolbar. This opens a new window showing the execution plan. Note that the output format is different from the output provided by the plan-only approach.

About the Author

Photo of Markus Winand

Markus Winand is the SQL Renaissance Ambassador. He is on a mission to introduce developers to the evolution of SQL in the 21st century. Markus can be hired as trainer, speaker and consultant via winand.at.

Buy his Book on Amazon

Cover of “SQL Performance Explained”: Squirrel running on grass

The essence of SQL tuning in 200 pages

Buy on Amazon
(paperback only)

Paperback and PDF also available at Markus’ store.

Hire Markus

Markus offers SQL training and consulting for developers working at companies of any size.
Learn more »

“Use The Index, Luke!” by Markus Winand is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License.
Legal | Contact | NO WARRANTY | Trademarks | Privacy and GDPR | CC-BY-NC-ND 3.0 license