7.6SQL Performance Optimization

The SQL performance optimization tool—the SQL Performance Tuning Worklist—is a new development available as of AS ABAP 7.4 and was ported up until Release 7.02. It can be used to combine data from a static code analysis (e.g., the data associated with a check run in the ABAP Test Cockpit) with runtime measurements from the SQL Monitor (or Coverage Analyzer [Transaction SCOV]) to determine the points where optimization is promising for SAP HANA. We’ll now show you how to link the results of a static analysis with the results of the SQL Monitor. This link uses a join that is based on the call point.

In Section 7.3, you learned how to perform static code analyses, and, in Section 7.5.2, we explained how to use Transaction SQLM to collect data. These two pools of data can now be linked to each other in Transaction SWLT.

Don’t make any restrictions or changes on the General tab. Then, on the Static Checks tab (see Figure 7.43), select the Use Static Check Data checkbox. Then select an ABAP Code Inspector or ABAP Test Cockpit check that was run previously. A check run can be used both from the local and from a remote system (using the RFC Destination field).

Transaction SWLT: Static Checks

Figure 7.43Transaction SWLT: Static Checks

Then select the Use SQL Monitor Data checkbox on the SQL Monitor tab (see Figure 7.44). To select a snapshot, click on Manage/Create Snapshot. You can use the local system, a remote system that is connected via RFC, or a file import as the data source. An SQL Monitor snapshot must have been created first, however.

Transaction SWLT: SQL Monitor Data

Figure 7.44Transaction SWLT: SQL Monitor Data

You can now run the analysis by clicking on the inline icon.

The result list includes a screen that is divided into three sections (see Figure 7.45):

The upper area of the screen shows the data from the SQL Monitor and the corresponding results of the ABAP Code Inspector check (both aggregated by call point; see the top right area of Figure 7.45). When you click on the Include Name field, the system takes you directly to the call point of the SQL statement. If you double-click a row of the results overview, you receive the SQL Monitor results in the bottom left area (not aggregated). Clicking on Request Entry Point or Table Names takes you to the request entry point or DDIC. The ABAP Code Inspector results are displayed in nonaggregated form in the Static Check Findings area. When you click on the link in the Additional Information field, the system takes you to the results of the Code Inspector check, for example, the call hierarchy of an SQL statement in loops.

The SQL Performance Tuning Worklist is a very powerful tool that can be used to plan optimization projects for SAP HANA very efficiently. If SQL statements are assigned to applications, they can also be assigned to business processes. Runtime measurements show which SQL statements require a large amount of time or run very frequently. The static analysis shows where there is potential for optimization and how time-consuming such an optimization would be. Combining this data into one transaction is extremely useful for detecting the source code with the best cost-benefit ratio for applying optimizations.

Compared to the SQL Monitor, the main result list contains some additional columns. From the DDIC, you obtain the following information for the database tables:

You also obtain information about the Code Inspector checks:

You can use these columns to compare the results and prioritize where an optimization would be most beneficial.