In this recipe, we will see a few examples of problems of the SELECT
statements that the code inspector may highlight. This may help in improving performance of the program at the development stage. The performance checks are available in both the transactions SCI
and SCII
. We will emphasize on the selection of the database-specific performance checks during variant creation, and some of the typical statements/constructs that may be caught using code inspector.
The inspection checks the various program and highlights as warning statements that are performance statements. During this, the code inspector checks the syntax of the program and refers to the attributes and technical settings of the tables involved.
CHECK
or EXIT
statements used within a SELECT
statement instead of highlighting a WHERE
clause.SELECT
statements included in a loop such as a DO
loop or within a loop at ITAB
.SELECT
statements that use the BYPASSING BUFFER
addition.SELECT
statements that are without a WHERE
clause will be included in the warning. The following is one such example:SELECT * FROM ZMYTAB INTO IT_TAB
SELECT
statement.SELECT FIELD1 INTO TABLE IT_FIELDS FROM ZTAB1 WHERE FIELD2 EQ 'ABC' AND FIELD3 IN ( SELECT FIELD1 FROM ZTAB2 WHERE FIELD2 EQ 'Z1' AND FIELD3 EQ'A'.)
ZTAB2
table is buffered, a warning message will appear in the result.SELECT
statement on any table that is single-record buffered and a SELECT * ENDSELECT
statement is used in the program, the corresponding statement will be highlighted in the results.WHERE
clause of the query does not correspond to any index in the database for the table in question, a message appears in the inspection results. This hints that there is a possibility that a full sequential scan will be run for the query that could be very time-consuming.WHERE
clause—for example, if the index in the database comprise of fields A1
, B1
, and C1
, and the WHERE
clause of the query includes B1
and C1
but not A1
, a warning is generated.Though the Code Inspector aid in writing better code, they have certain limitations. It is possible that a program generates no messages during the inspection, but may be slow when actually executed in QAS or production system.
The code is only analyzed and scanned along with the information pertaining to attributes of the dictionary tables used. The code is not executed (with actual data). The true performance test and analysis must be based on the actual execution tools such as transaction SAT and SQL
trace. The checks of code inspector do not replace these tools.
3.147.44.182