Professional Documents
Culture Documents
My previous posts give an introduction on SAP database performance monitor and talk about
how to run SAP transaction ST04 and navigate to frequent accessed ST04 screens. This post
would choose several frequent referenced ST04 screens and talk about
1. How to understand the information in ST04 screens.
2. How to use ST04 information from those screens to do performance tuning.
This post is based on experiences on the SAP system I am working with. Before I go down to
the details, I would like to highlight that it is important to get yourself familiar with the
normal status of database performance and establish database performance baselines which
can be used for comparison for future performance issue. In general, database performance
can be improved via application/SQL code tuning, database itself tuning and OS-level tuning.
Often, system and application performance can be improved via application/SQL code
tuning. Poor database performance is normally an outcome of inappropriate application/SQL
design other than database configuration and Server setting.
1 SAP database performance overview
1.1 The database performance overview screen
Data
buffer
Shared
Pool
Log
buffer
Call
Calls displays the total number of user calls in the database since
it was started.Commits
displays the total number of committed transactions since the
database was started.Rollbacks
displays the number of rolled back transactions since the database
was started.Recursive calls
displays the number of recursive calls.Recursive calls/user
calls display total number of recursive calls and user calls. SAP
mentions total number of recursive calls should be smaller than
the number of user calls by a factor of 5 in a productive
environment.
Parses displays the total number of parsed SQL statements. SAP
mentions the rate of Parses to User Calls should be under 25%.
Reads / User calls displays the number of Oracle blocks read on
average from the data buffer to answer user queries. If this
number is greater than 30, this points to expensive SQL
statements.
Display summary of database wait situation. Wait itself would not
consume resources but a result of resource contention. Wait
situation should be reviewed and mitigated whenever possible.
Time
Statistic
s
Busy wait time shows the cumulative time that is used up,
because the database system had to wait for a resource that was
not available at the time of the request. If this value is high, you
must perform a detailed analysis via Oracle wait event
analysis.CPU time:
total CPU time used since database was started.
CPU usage:
average CPU usage since database was started.
Redo
Logging
Table
scans &
Fetches
Fetch By rowid
fields displays total number of table rows chosen by index or by a
unique ID (row ID, ROWID) in the SQL statement since database
was started.
Continued Row displays the number of chained Rows fetched
since database was started.
Displays the total number of sort operations performed in the main
memory and on the disk.
Sorts
Buffer busy wait: You can refer to Oracle online document for more information on buffer
busy wait. It mentions three main causes for buffer busy wait: accessing a data block which
is under changes; insert into the same block at the same time; concurrent reads on the
same physical block.
Recursive call: following is excerpt from Oracle document on Recursive calls
Sometimes, to execute a SQL statement issued by a user, the Oracle Server must issue
additional statements. Such statements are called recursive calls or recursive SQL
statements. For example, if you insert a row into a table that does not have enough space to
hold that row, the Oracle Server makes recursive calls to allocate the space dynamically if
dictionary managed table spaces are being used.
Recursive calls are also generated:
When data dictionary information is not available in the data dictionary cache and
must be retrieved from disk
In a standard SAP environment, Recursive calls if there is any are transparent to SAP
developers in my view.
1.3 Performance analysis via ST04 database performance overview screen
Information from ST04 performance overview screen cannot lead to a conclusion or solution
and is servicing a hint/direction for further investigation in most cases.
Data
buffer
Shared
Pool
Log
buffer
Calls
Time
Statistic
s
Redo
Logging
Table
scans &
Fetches
Sort
You can reference to SAP document for some threshold values mentioned in table 2. You can
use reset point to see how statistics are changed after reset in comparison with information
since database was started.
2 SAP ST04 SQL Cache Monitor screen
2.1 SAP ST04 SQL cache monitor screen
Field
Explanation
Field
Explanation
Executio
ns
Total number of
times which a SQL
statement is
executed.
Elapsed
Time
Accumulated
runtime for all
execution of a SQL.
Disk
reads
Number of disc
blocks reads.
Elapse
Time/Exec
Reads/Ex
ec
Average number of
disc reads per SQL
execution.
CPU Time
Buffer
gets
Total number of
buffer read.
CPU
time/Executi
on
Bgets/Ex
ec
Average number of
buffer read per SQL
execution.
Wait time
Proc.
Rows
Total number of
rows
processed/returned.
SQL
statement
SQL statement in
the cache. SQL
statement in lower
case is related to
system operation.
Rproc/Ex
ec
Average number of
rows per SQL
execution.
Program
name
There are more screen fields than what listed in table 3 like fields related to memory usage
etc.
Figure 4 SQL execution plan screen tells you the access strategy used by database to fulfill
the SQL statement. Following are corresponding field explanation in Figure 4.
Table 4 Explanation of ST04 SQL execution plan screen
Field
Explanation
Field
Explanation
Search
Column
Number of
field used in
accessing
index.
Estimate
d Costs
Estimate
d Rows
Projection on number of
rows returned by the SQL
Access
Predicat
es
A list of fields
used in
accessing
index.
Sequence
number
1, 2 etc.
Filter
Predicat
es
A list of fields
used in filter
records
Oracle CBO always choose a plan with lowest cost based on calculation. However the cost
calculation can be influenced by many factors. One of factors is table statistics so obsoleted
table statistics can lead to unreliable cost which leads to improper SQL execution plan.
I have not mentioned column selectivity and index cluster factor screen which can be
brought up if you double click on the index in execution plan. You might need to review this
information.
You can refer to table 3 to understand the information in SQL analysis report screen (figure
5).In some cases, load distribution can help to understand the performance change of a
transaction or business application.
2.3 SQL Performance tuning via ST04 SQL cache screens
Most of database performance issues are related to application design (code and table/index
design), which needs application owner to fix it. If issue cannot be fixed via code/application
design change, then it might need database level changes like statistics updating and
table/index reorganization which is normally owned by Basis/database guy. It seldom
happens that we change a database configuration design to fix a performance issue.
Database configuration changes can include IO design like table distribution, data striping
etc. to mitigate hotspot for concurrent accesses. ST06 can be used to identify hot disc based
on utilization.
SAP ST04 cache screen contains a lot of statistics data like number of execution, disc read
etc. as you have already seen. Sorting on those statistics in descending, most expensive SQL
statement would be at top of the list so you can review those top SQL statements to identify
tuning opportunity. Tuning expensive SQL code can improve underlying application
performance, sometimes, tuning expensive SQL can have big improvement on overall
database performance if total physical read and logical reads is reduced. For example,
reducing physical read can reduce demand on buffer so database would needs less buffer
space to execute a SQL statement, this means less existing data is moved out of buffer.
2 . 3 . 1 S Q L C A C H E A N A LY S I S
SQL cache analysis is a critical performance tuning area for database and application
performance. Following is a list of performance analysis based on SQL cache review.
Table 5 SQL performance analysis via ST04 SQL cache
Tuning
categor
y
Tune
SQL disc
read
Scope
Approach
Tune
SQL
memory
read
Tune
SQL
respons
e time
Tune
SQL CPU
time
Tune
SQL Row
process
ed
Approach in table 5 mentioned is mainly from application solution point view. There might be
database level changes which can be done to improve performance like index/table
reorganization, table statistics updating(including histogram) and index/table sorting,
table/index compression, other oracle memory/storage parameter changes, disc stripping
etc. which might be needed based on storage analysis and wait event analysis.
There are overlapped among different categories. For example, one SQL can show up as Top
expensive SQL under response time and Top expensive SQL under Disc IO as well.
Here, I mentioned to combine similar jobs and/or job steps to reduce disc IO, buffer gets.
However there are other factors we need to consider before we consolidate jobs or job steps.
For example, memory utilization, business performance goal as well as relation between
program performance and volume.
SQL tuning is focusing on select SQL statement other than insert statement in most
cases. There is really no way for you to reduce number of rows and number of insertion or
control which table should be inserted into in a SAP system. But for select statement, this
is tricky since the same information usually shows up in different SAP tables, many records
can meet one selection criteria as well as SQL where-clause design can influence oracles
table access strategy.
When there is a database performance issue, you can use reset point in SQL cache monitor
to see what is most expensive SQL for a problematic period after reset, you might find this
helpful sometimes.
SQL is either getting data from base table or from the index table. When it read data from
table, it either access table via index or without index. When you analyze SQL execution
plan, please pay attention to following points:
ST04 SQL cache analysis would not tell you about duplicated selection. To get such
information, you need to run ST05/ST12 trace on execution of related program. Then you
can analyze the SQL trace. If you wonder how to do that, you can refer to my post SAP
ST12 trace SQL performance analysis.
I did encounter performance issue due to fields in Search Column. Those error are Oracle
CBO error could be due to Oracle bug or table/system statistics status. The solution to fix
this is normally statistics updating or Oracle patches or solution change.
It is important to review table cluster factor and index column selectivity as well. You can
find such information by double clicking index name in SQL execution plan screen. Lower
selectivity and high cluster factor can be a reason for poor performance which can be
addressed via table/index/program changes( the former ) and table/index reorganization( the
latter ).
SQL analysis report is used to identify load changes over time.
3 SAP ST04 Database session monitor
You can use ST04 session monitor to understand current activities of Oracle session. This
helps to understand the performance of system and applications
3.1 SAP ST04 database session monitor screen
Field
Explanation
Field
Explanation
SID
Oracle Session ID
Logical Reads
Total number of
physical read
and memory
read occurs
under the
session
Op.
Sys. PID
Operating system ID
related to the Oracle
session.
Physical Reads
Physical reads
Client
system
Related system
where client process
is running.
Block Change
Number of
block changed
by the session
Client
Proc.
Corresponding client
process for the
Oracle session. One
Client process can
create more than
one oracle sessions
PGA_USED_ME
M
Current used
PGA memory by
the oracle
session
Status
Session status
PGA_MAX_MEM
Max memory
used by the
oracle session
Event
User
Related SAP
user-id which is
related to
Oracle session
SQL
statem
ent
Corresponding SQL
statement which is
executing
Client info
Related SAP
program.
Performance
analysis
Approach
Understand
process status
Check SQL
execution plan
and
corresponding
code
Memory
utilization
Event analysis
DB01 display
Parent
Parent
Child
A
B
B
C
When many processes are locking each other and you would like to figure out which one is
root locker SAP ST04 lock monitor can provide a straightforward answer.
5 SAP ST04 Oracle Workload Reporting
Oracle workload Reporting includes:
SQL Report.
AWR report allows you to compare oracle workload between two periods this might be
helpful if there is an issue with database and you would like to figure out what causes the
performance difference. ADDM report would generate database tuning proposal.
Those are standard reports. You can refer to PDF document from Oracle company website to
understand how to use those reports for performance analysis.
6 Further clarification
In addition to this post, I have other two posts related to database performance monitor
SAP database performance monitor introduction and how to run SAP database
performance monitor ST04. My focus is mainly on how to tune SQL from application
performance point view and general understanding database performance monitor.
It is not my intention or within my abilities to cover all areas of database tuning. There is a
ton of documents on database tuning already Wait event analysis is critical for database
performance tuning, you can refer to online Oracle documentAutomatic Performance
Statistics for further reading. You can go to click here to understand more in details on
database performance tuning.
This entry was posted in SAP transaction and tagged How to understand SAP ST04
screens;How to use SAP st04 for performance improvement; how to use SAP ST04 for
performance improvement; SAP database SQL cache performance analysis; SAP ST04
database sess