Entering content frameComponent documentation Optimizer: SAP DB 7.3 Locate the document in its SAP Library structure

This documentation describes how the SAP DB Optimizer processes SQL statements. It provides information about the meaning and possibilities of creating optimal SQL statements for your application.


For general information about the SAP DB database system, see the Structure linkUser Manual: SAP DB.
For information about the syntax of the SQL statements that can be entered in SAP DB, see the
Structure linkReference Handbook: SAP DB 7.2 and 7.3

Optimizing SQL Statements

Determining the optimal SQL statements for a SAP DB application is an important task. Optimal SQL statements significantly influence the performance of the entire SAP DB application. An SQL statement is optimal if it is written in such a way that it can be processed in as short a time as possible with a minimal storage area requirement.

To process SQL statements optimally, the factors that influence the processing of an SQL statement must be considered. In particular, you should consider the influence of the search conditions on the processing of an SQL statement. There are a series of additional possibilities for runtime improvement for SQL applications.

The SQL statements should be written in such a way that search strategies can be used. The following goals should be achieved in doing so:

If a large number of changes has been made in a table, you should run the Structure linkUPDATE STATISTICS statement. This statement updates the details about the tables that are necessary for the work of the Optimizer (such as value distribution, size of tables, and inversions).

If you consider all of these hints, you can write optimal SQL statements.

Checking SQL Statements

  1. Check your SQL statements for correctness, for example, with the help of the SAP DB tool SQL Studio.
  2. Analyze your SQL statements with regard to the performance that can be achieved through them. To do this, use the appropriate EXPLAIN statements.

Only after you have completed these checks of your SQL statements should you insert them into your application program.

Leaving content frame