Generating an Execution Plan

View a statement execution (query) plan, which enables you to optimize the database and SQL code. Viewing an execution plan is useful during troubleshooting and performance tuning.

Prerequisites 

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

The execution plan indicates when to create table indexes, reorganize data tables, or change the way a query is written. It displays actual statistics when you view it during execution and estimated statistics when you view it without executing the SQL code.

The Execution Plan View Options preferences determine the type of execution plan generated by default. After generation, you can change the execution plan type in Execution Plan view.

  1. Open the SQL file, or the procedural object in its corresponding editor in the Source page.
  2. Include all statements or indicate a subset to include in the execution plan.

    If you want to include a subset of statements, highlight the ones you want to include. If you do not highlight any statements, all statements are included.

  3. Right-click and select Get Execution Plan.
  4. View the results in Execution Plan view.

    • The left pane displays a graphical or text representation of the SQL statements you have selected.

    • For graphics plans, the right pane displays other useful statistics. Select a node in the graphic to see details for that node.

  5. (Optional) Perform any of the following actions in Execution Plan view.
    Table 1. Execution Plan view options
    To Do this
    Remove the current plan from the view Select Remove Current Plan 
					 Remove.
    Remove all plans from the view Select Remove All Plans 
					 Remove All.
    Save the plan to a file Select Save Plans to File 
					 Save Plans to File, and indicate where to save the file and the file name.
    Load a previously saved plan Select Load Plans from a File 
					 Load Plans from File and select a plan to load.
    Show a previously generated plan Select Show Previous Plans 
					 Show Plan History and select a plan from the list.
    Switch to a different plan type Select Switch Plan Type Switch Plan Type and select a plan type from the list.
    Change execution plan preferences Click the view menu button and select Preferences.
    Change execution plan orientation Click the view menu button, and select Vertical View Orientation or Horizontal View Orientation.
Related concepts
Execution Plans
Execution Plan View
Related reference
Execution Plan View Options Preferences
ASE Execution Plan View Options
ASA Execution Plan View Options
Sybase IQ Execution Plan View Options


Created June 25, 2009. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com