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
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, thefactors 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 thatsearch 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 theUPDATE 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
Only after you have completed these checks of your SQL statements should you insert them into your application program.