0% found this document useful (0 votes)
58 views

Perform A Structured SQL Performance Analysis

This document describes performing a structured SQL performance analysis on class CL_HA400_CI_PERFORMANCE_ISSUES. The analysis includes inspecting the class code using Code Inspector, analyzing existing SQL Monitor data, and combining the static and dynamic findings using the SQL Performance Tuning Worklist tool to prioritize performance tuning efforts. The maximum database time consumption was found to be from a SELECT statement in method get_days_ahead_for_customer, which has been executed several hundred thousand times. Avoiding repeated single record accesses and reducing the SELECT * could help reduce the database time for this statement.

Uploaded by

Esther Vizarro
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views

Perform A Structured SQL Performance Analysis

This document describes performing a structured SQL performance analysis on class CL_HA400_CI_PERFORMANCE_ISSUES. The analysis includes inspecting the class code using Code Inspector, analyzing existing SQL Monitor data, and combining the static and dynamic findings using the SQL Performance Tuning Worklist tool to prioritize performance tuning efforts. The maximum database time consumption was found to be from a SELECT statement in method get_days_ahead_for_customer, which has been executed several hundred thousand times. Avoiding repeated single record accesses and reducing the SELECT * could help reduce the database time for this statement.

Uploaded by

Esther Vizarro
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Solution 8

Perform a Structured SQL Performance


Analysis
Analyze the Source Code of Class CL_HA400_CI_PERFORMANCE_ISSUES

Log on to the application server ZME on Sybase with system ID ZME. Open class
CL_HA400_CI_PERFORMANCE_ISSUES and analyze the coding.
1. Open class CL_HA400_CI_PERFORMANCE_ISSUES.
a) Start the ABAP Workbench (for example using transaction code SE80).
b) Choose Repository Browser if it is not chosen yet.
c) Choose the Class object category.
d) Enter the class name as the object name and press Enter.
e) Double-click the class.

What are the public methods of the class?


The public methods are get_customers and get_agencies.
What are the private methods and where are they called?
The private method get_days_ahead_for_customer is called from method
get_customers and method get_days_ahead_for_agencies is called from
method get_agencies.

Are there any conditions for these calls?


Both private methods are only executed if import parameter iv_with_days of
the corresponding public method is set to abap_true.

Analyze Class CL_HA400_CI_PERFORMANCE_ISSUES with Code Inspector


Use the Code Inspector tool to see if class
CL_HA400_CI_PERFORMANCE_ISSUES has any SAP HANA relevant
performance issues.
Hint:
Global check variant PERFORMANCE_DB contains the SAP HANA relevant
checks.
1. Perform an inspection of the class based on check variant PERFORMANCE_DB
(suggested name for the inspection: HA400_##_SWLT).
a) Start transaction SCI.
b) In the Inspection frame, enter the name for the inspection and choose Create.
c) In the Object Selection frame, enter Single, Class, and type in the name of your
program.
d) In the Check Variant frame, enter the name of the check variant.
Hint:
You might have to choose the button on the left of the input field before you can
choose global check variants.
e) On the toolbar, choose Execute (F8).
2. Analyze the inspection result.
a) To see the inspection result, on the toolbar, choose Results (Shift F6).

b) Check the reported errors. To navigate to the ABAP source code, double-click the
message.
How many SAP HANA-relevant performance errors does the check find and in which
methods?
There are three performance errors in methods get_days_ahead_for_customer
and get_days_ahead_for_agencies.
What information is missing for prioritizing the performance errors?
How often the different methods are actually executed in the productive
system, in particular, how often import parameter iv_with_days is set to
abap_true.

Analyze Existing SQL Monitor Data for Class


CL_HA400_CI_PERFORMANCE_ISSUES
With the SQL Monitor tool, analyze a snapshot of SQL Monitor data. Restrict the
display to measurements related to class
CL_HA400_CI_PERFORMANCE_ISSUES.
Note:
The description of the snapshot begins with “SQLM Snapshot for HA400”.
1. Start the SQL Monitor tool and display the data of the snapshot.
a) Start transaction SQLM.
b) In the Snapshots frame, choose Display Snapshots.
c) In the Results frame, choose Select Snapshot.
d) Select the line where the content of column Description starts with SQLM
Snapshot for HA400 and choose Enter.

e) In the Object name field, enter the name of the class and choose Execute (F8).
2. Find the statement with the maximum consumption of database time.
a) Sort the list descending by column Total DB time.
Which SQL statement has consumed the maximum database time?
A SELECT from table SBOOK.
Which processing block contains this statement?
Method get_days_ahead_for_customer.

Combine Static and Dynamic Analysis for Class


CL_HA400_CI_PERFORMANCE_ISSUES
With the SQL Performance Tuning Worklist tool, combine the Code Inspector
findings and the
SQL Monitor data to build a prioritized work list for SQL Performance tuning.
1. Start the SQL Performance Tuning Worklist tool and restrict the analysis to your
class.
a) Start transaction SWLT.

b) In the Object name field, enter the name of the class.


2. Activate the analysis of SQL Monitor data and select the same SQLM snapshot as
before.
a) Choose the SQL Monitor tab.
b) Choose Use SQL Monitor Data if it is not yet chosen.
c) Choose Select Snapshot.
d) Choose the SQLM snapshot with the description starting with “SQLM Snapshot for
HA400 ....”
3. Activate the analysis of static check data and specify your code inspector
inspection.

Make sure the program aggregates findings by code position.

a) Choose the Static Checks tab.


b) Choose Select Inspection.
c) Select your inspection (suggested name was: HA400_##_SWLT).
d) In the Further Options frame, in the Aggregate Findings in Overview field, choose
the By Code Position entry.
4. Execute the analysis in the SQL Performance Tuning Worklist tool.
a) Choose Execute.

5. Analyze the static and SQL Monitor findings for the various SQL statements of
class CL_HA400_CI_PERFORMANCE_ISSUES. Start with the finding with the
maximum DB time.
a) In the Result Overview, make sure the results are ordered by column Total DB
time.
b) Click on the SQL statement with the largest value in the Total DB time column.
c) Analyze the entries in SQL Monitor Results and Static Check Findings.
How often has the statement been executed?
Several hundred thousand times.
What can you do to reduce the DB time consumption?
Avoid the repeated single record accesses and get rid of the SELECT * in this
statement.

You might also like