Identifying Expensive SQL Statements

Expensive SQL statements are long-running statements and one of the main causes of performance problems.


Expensive SQL statements can have the following effects on the entire system:

->They cause high CPU utilization percentages and high I/O loads

->They block SAP work processes for a long time.

->They read many data blocks into the data buffer of the database server, which displaces data required by other SQL statements.


Analyzing Currently Running SQL Statements

DBA Cockpit - PERFORMANCE • WAIT EVENT ANALYSIS • SESSION MONITOR

The following are important events:

CPU, which indicates that the database CPU currently executes an operation (for instance, sorting)

DB FILE SEQUENTIAL READ for a file access

SQL*NET MORE DATA TO CLIENT (or also ... MORE DATA FROM CLIENT), I which means data from the shadow process is transferred to the SAP work process (or vice versa)

ENQ: TX - ROW LOCK CONTENTION, which shows that a shadow process is waiting for a lock


Because both monitors display the application server and the PID of the related SAP work process for the database processes, you can see which database process corresponds to which SAP work process. From the two monitors, you can determine the following:

->Program name and transaction code of the executed program (from the work process overview)

->Table name (from the work process overview and the database process monitor)

->The user who started the program (from the work process overview)

->WHERE conditions of the SQL statement (from the database processmonitor)

->In the database performance monitor, you can use the ExPLAIN function to create an execution plan for the SQL statement;

Detailed Analysis of Times Used in Shadow Processes (Oracle Wait Events)

Analysis of Statistics of SQL Statements (SQL Statistics)

Fields of the SOL Statistics as an Example of the Oracle Shared Cursor Cache

FieldExplanation
ExECUTIONSNumber of times the statement has been executed since the start of the database.
ELAPSED TIMETime required for all the executions of the statement.
ElAPSED TIME/EXECUTIONAverage time required for an execution of the statement.
DISK READSNumber of physical read accesses required for all executions of the statement; a high value indicates that there were a lot of read accesses to the hard disks.
READS/EXECUTIONNumber of physical read accesses required, on average, for one execution of the statement.
BUFFER GETSNumber of logical read accesses required for all the executions of the statement; the ratio of buffer gets and disk reads indicates whether many accesses are possible from t he buffer.
BUFFER GETS/ ExECUTIONNumber of logical read accesses required, on average, for one execution of the statement.
PROCESSED ROWSNumber of rows read for all of the executions of the statement.
PROCESSED ROWS/EXECUTIONAverage number of rows read for an execution of the statement.
BUFFER GETS/ROWAverage number of logical read accesses per row read; a high value indicates an inefficient search strategy (except for aggregating accesses-for instance, summation).

Analysis of the SQL statistics

1. Sort the SQL statistics according to the ELAPSED TIME column.
2. Are there only a few expensive SQL statements that constitute more than 5% of the total? If this is the case, you can usually improve database performance significantly by tuning these statements.




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值