Chat now with support
Chat with Support

SQL Optimizer for SAP ASE 3.9.1 - User Guide

Introduction Tutorials Preferences Editor Functions SQL Information and Functions Performance Monitor SQL Inspector SQL Collector for Monitor Server SQL Scanner Index Advisor SQL Optimizer
SQL Optimizer Overview Optimization Engine Common Coding Errors in SQL Statements What Function Should l Use to Retrieve the Run Time? Unsatisfactory Performance Results SQL Optimizer Functions SQL Editor Optimized SQL Activity Log
SQL Worksheet SQL Formatter Database Explorer Code Finder Object Extractor SQL Repository Index Impact Analyzer Index Usage Analyzer Configuration Analyzer Migration Analyzer Abstract Plan Manager User-Defined Temp Tables SQL History Legal Information

SQL Classification

Based on the query plan, a SQL statement is classified according to the characteristics of the query plan. If the query plan is not retrieved successfully, then these SQL statements are classified as Invalid SQL. A SQL statement can be invalid if the database object it references does not exist, the database user does not have privileges to access it, or the incorrect database and user are used to scan the Job.

All valid SQL statements are further classified as Simple, Complex, or Problematic SQL statements.

Problematic SQL Statements

Problematic SQL statements are potentially under performing SQL statements that should be optimized. Problematic SQL satisfy one of the following criteria:

  • The number of tables referenced in the query plan of a SQL statement exceeds the upper limit of the Complex table scan operations range.

  • Single full table scan with table size larger than the threshold size.

  • Single full table scan in a nested loop with table size larger than the threshold size.

  • The number of worktables is greater than or equal to the defined value if the With Worktable checkbox is selected in the Preferences window.

  • The number of reformatting.

Complex SQL Statement

Complex SQL statements are complicated SQL statements where there is room for improvement. Complex SQL satisfy one of the following criteria:

  • If the number of tables referenced in the query plan of an SQL statement falls into the Complex table scan operations range defined in the Preferences window.

  • SQL statements with full index scan.

Simple SQL Statement

Simple SQL statements are direct and straightforward SQL statements with minimal probability of improvement. SQL statements are defined as Simple SQL statements when number of tables referenced in the query plan is less than the lower limit of the Complex table scan operations range; the default value is 1 table.

 

Problematic SQL

SQL statements are classified as Problematic SQL if they meet any one of the following requirements:

Number of table operations greater than (Default = 3)

Read-only field indicating the number of table operations references in the query plan. If the total number of table operation is greater than this value, then this SQL statement is classified as Problematic. This value is the same as the upper limit of the Complex table operations range.

With full table scan

Specify that SQL statements with full table scan are classified as Problematic SQL statements. This classification depends upon the size of the table or the number of row.

Table size (KBytes): (Default = 16, Range= 8 to 9,999,996)

Number of rows: (Default = 1000)

In the case of a temporary table where the size is unknown when the query plan is retrieved, any full table scan will be classified as problematic.

Note: Table size is calculated using sp_spaceused.

You can specify to include or exclude inserted or deleted simulation temp table created in the SQL Scanner Trigger Conversion by using the Including inserted simulation temp table and Including deleted simulation temp table checkboxes.

With full table scan iterated by nested loop

Specify whether SQL statements with a full table scan inside a nested loop are classified as Problematic SQL statements. This classification depends upon the size of the table or the number of row.

Table size (KBytes): (Default = 16, Range= 8 to 9,999,996)

Number of rows: (Default = 1000)

You can specify to include or exclude inserted or deleted simulation temp table created in the SQL Scanner Trigger Conversion by using the Including inserted simulation temp table and Including deleted simulation temp table checkboxes.

With number of worktables greater than or equal to (Default = 1, Range = 1 to 99)

Specify that SQL statements involving the number of worktables greater than or equal to the defined number are classified as Problematic SQL statements.

With number of Reformattings greater than or equal to (Default = 1, Range = 1 to 99)

Specify that SQL statements whose query plan uses reformatting are classified as Problematic SQL. Reformatting is the process of generating a worktable with a clustered index and performing a nested-loop join. The Adaptive Server optimizer may choose this strategy when the table is large and does not have any useful index for a join.

 

Related Topics

Complex SQL

SQL statements are classified as Complex SQL if they meet any one of the following requirements and do not meet any requirement for being a Problematic SQL statement:

Number of table operations (Default = 2 /3, Range 2 to 99)

Specify the number of table references in the query plan for Complex SQL statements. Checkboxes are available to indicate whether you want the inserted and deleted simulated temp tables to be included in this table range.

You can specify to include or exclude inserted and deleted simulation temporary tables created in the SQL Scanner Trigger Conversion by using the Including inserted simulation temp table and Including deleted simulation temp table checkboxes.

With full index scan (Default = checked)

Specify whether SQL statements with full index scan are classified as Complex SQL statements.

 

Related Topics

Simple SQL

SQL statements are classified as Simple SQL if they meet the following requirement and do not meet any requirement for being a Problematic SQL statement or a Complex SQL statement:

Number of table operations less than (Default = 2)

Read-only field indicating the number of table operations references in the query plan. If the total number of table operation is less than this value, then this SQL statement is classified as Simple. This value is the same as the lower limit of the Complex table operations range.

 

Related Topics

Related Documents

The document was helpful.

Select Rating

I easily found the information I needed.

Select Rating