Obtaining an Execution Plan

View a statement execution plan by selecting the statement from the editor and using the context menu to visually display the execution plan.

This feature allows developers or database administrators to optimize the database and SQL code. SQL developers or database administrators can tell from the query plan when to create table indexes, reorganize data tables, or change the way a query is written. This feature can be useful during troubleshooting and performance tuning.

The query plan displays actual statistics when you view it during execution. The plan displays estimated statistics when you view an execution plan without executing the SQL.

In the Execution Plan View Options preferences page, you can specify the plan orientation, whether to show the plan while execution is taking place, and the style of plan displayed.

Before you can get a query plan from within a SQL file, the SQL file must be connected to a data server connection profile.

  1. Open a SQL file or procedural object in its corresponding editor.
  2. In the source for SQL file or procedural object, select the statement or statements for which you want to display an execution plan.

    To obtain the execution plan for the entire SQL file or procedural object, skip this step.

  3. Right-click and select Get Execution Plan.
    The Execution Plan view opens with:
    • A frame that displays a graphical or text representation of the SQL statements you have selected.

    • For graphics plans, a second frame that displays useful statistics such as rows returned, run time, CPU time, and disk read/write times; and various options used, such as case sensitivity, character set, date format, encryption, histograms, start time, and thread count. In a graphics plan, click a node in the graphic to see details for that node.

  4. (Optional) Choose any of these actions to change the plans you can see in the Execution Plan view:
    To Do this
    Remove the current plan from the view Click Remove Remove Current Plan 
      .
    Remove all plans from the view Click Remove All Remove All Plans 
      .
    Save the plan to a file Click in either frame of the Execution Plan view, and click Save Plans to File Save Plans to File 
      .
    Load a previously saved plan Click Load Plans from File Load Plans from a File 
      , and select a plan to load.
    Show a different plan Click Show Previous Plans Show Previous Plans 
      , and choose a plan from the Previous Plans dialog, or click Remove to remove the selected plan.

    You can also click the black Show Previous Plans drop-down to show a different plan or to remove all plans.

  5. (Optional) Click the drop-down menu button to change query plan preferences or to change the orientation.
Related concepts
Execution Plans
Execution Plan View
Related tasks
Creating a Graphic Execution Plan
Creating a Text Execution Plan
Related reference
Execution Plan View Options
ASE Execution Plan View Options
ASA Execution Plan View Options
Sybase IQ Execution Plan View Options

Send your feedback on this help topic to Sybase Technical Publications: pubs@sybase.com

Your comments will be sent to the technical publications staff at Sybase, Inc. For product-related issues or technical support, contact Sybase Technical Support at 1-800-8SYBASE.