Once you have created a name for the tuning job and indicated its source, you can add SQL statements that you want the job to tune. Statements are added to a job via the options available in the SQL list on the Overview tab. All standard DML statements (SELECT, INSERT, DELETE, UPDATE) are viable for the tuning procedure. On SQL Server 2008 and higher, MERGE statements can also be tuned.

There are four or five different ways to add SQL statements to a job, as reflected by the options available in the SQL list as shown previously:

  • New SQL Text. Copy/paste SQL statements to the New SQL Text window or write queries by hand. You can also paste a statement directly into the Overview statement grid by copying the statement, right-clicking anywhere on that grid, and then selecting Paste.
  • Extract from Database Object. Drag and drop database objects from the Data Source Explorer to the Statements grid on the Overview tab.
  • Import from File (Workspace) and Import from File (System). Browse the workspace or file system and select SQL files.
  • Scan Oracle SGA. For the Oracle platform only, you can also scan the System Global Area (SGA) for statements to tune.

Add New SQL Text

From the SQL list, select New SQL Text, and then manually type an SQL statement in the window. Alternatively, copy/paste the statement from another source.

Add a Database Object

From the SQL list, select Extract from Database Object. The Data Source Objects Selection dialog appears. Type an object name prefix or pattern in the field provided, and then choose a statement from the window as it populates to match what you typed.

You can also drag an object, such as a Packages, Package Bodies, Views, and Functions, from the Data Source Explorer to the grid on the Overview tab. In order to drag a database object on the Overview tab, the database object in the Data Source Explorer must be in the same database that displays in the bread crumbs at the top of the Tuning window.

Add a Saved SQL File

From the SQL list, select Import from File (Workspace) or Import from File (File System), depending on where the file you want to add is stored. Select a file from the dialog that appears and it will be added to the tuning job.

Add Active SQL in SGA

From the SQL list, select Scan Oracle SGA. Specify any filters as required, and then click Next. From the list of SQL statements retrieved from the SGA, select those you want to optimize, and then click Finish. The selected statements are copied to the tuning job.