How to find the root cause of performance for SQL

1.Duplicate运行慢的场景,并重新运行这个场景

2.用工具db2mon.exe或者其他方式监控正在运行的sql,找出一直在excuting 的sql

 

这个或这些sql是导致运行慢的原因,尝试优化sql来解决问题。

3.用Execute plan来分析sql在哪一部份的cost最高,然后对这一步进行优化

4.For step 3, we first use reorgchk command to check whether the table and index need be reorged.

   If yes, run reorg command and runstat, then test the peroformance again.

If the result is unsatisfied we should to find the index of this sql used,  there will be 2 case happened, case a, there is no index;

case b, It is very possibility you could found the query did not use the index we wanted but used          another bad index. then we have some solution,

 

For case a, we should create some indexes for the table.

For case b, we should

    b0. adjust sql to use the correct index.

    b1. force the correct index use some way in DB2 9.5.

    b2. drop the bad index if it is possible, the sql will use the correct index automatically.

   

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值