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.

Previous pageNext page

You can’t learn everything in one day. Subscribe the newsletter via E-Mail, Twitter or RSS to gradually catch up. Have a look at modern-⁠sql.com as well.

About the Author

Photo of Markus Winand

Markus Winand provides insights into SQL and shows how different systems support it at modern-sql.com. Previously he made use-the-index-luke.com, which is still actively maintained. Markus can be hired as trainer, speaker and consultant via winand.at.

Buy the Book

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

The essence of SQL tuning in 200 pages

Buy now!
(paperback and/or PDF)

Paperback also available at Amazon.com.

Hire Markus

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

Connect with Markus Winand

Markus Winand on LinkedInMarkus Winand on XINGMarkus Winand on Twitter
“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