话说回来,bp hit ratio只是一个指标,一般来说hit ratio低只是代表只有不多的数据能够直接从bp里面获取,这个并不是说,在所有情况中,bp hit ratio低就代表性能不好。
在某些情况下,hit ratio低是正常的,也是性能优秀的表现,比如在一个oltp系统里面,一个有几十亿数据的数据库,用户的查询走索引,每一次索引完毕后都能够很快地指向唯一的RID,这样的话一般来说这行数据都不可能在bp里面的,因为OLTP基本都是random access,这样的话自然hit ratio很低,而且也是索引优秀的表现……
不过在你得这个系统里应该不是上面所说的那个情况:
Rows deleted
= 110952
Rows inserted
= 141454
Rows updated
= 109158
Rows selected
= 25592431
Rows read
= 7053508226
Binds/precompiles attempted
= 345
这个说明平均一个query和DIU需要读取271行,并且从
Buffer pool data logical reads
= 184436
Buffer pool data physical reads
= 132849
Buffer pool temporary data logical reads = 0
Buffer pool temporary data physical reads= 0
Asynchronous pool data page reads
= 126542
Buffer pool data writes
= 0
Asynchronous pool data page writes = 0
Buffer pool index logical reads
= 1441
Buffer pool index physical reads = 46
可以看出,如果是OLTP系统的话索引作的不大好,1441个索引读对应184436数据页读……
其中譬如说下面这个语句
Buffer pool data logical reads
= 313
Buffer pool data physical reads
= 305
Buffer pool temporary data logical reads = 0
Buffer pool temporary data physical reads= 0
Buffer pool index logical reads
= 3
Buffer pool index physical reads = 1
Buffer pool temporary index logical reads= 0
Buffer pool temporary index physical reads = 0
Blocking cursor
= YES
Dynamic SQL statement text:
SELECT TOTAL_ACTION FROM SPC.SPCGDAT WHERE DC_TYPE = 'Process' AND GNO = 1440 AND CNO = 10 AND CTYPE = 20 ORDER BY PROC_DATETIME DESC FETCH FIRST 1 ROWS ONLY
hit ratio就相当低,是不是可以考虑对PROC_DATETIME作reorg……你可以从这种方面入手看看
看到你有很多类似的查询语句,感觉是你有order by语句,所以就算是fetch first 1 row only,也需要把所有符合条件的语句找出来。这样的话如果你的数据分布不是按照order by的那个列走的,就需要根据rid在磁盘中找来找去,不能有效运用prefetcher……
还有,你得查询语句里面好像根本不用parameter marker……这样在分析的时候会很困难的,因为不能够把同样类型的查询集中在一起,所有的看起来都是完全不同的查询……
或许在列DC_TYPE, GNO, CNO, CTYPE和PROC_DATETIME DESC上作索引也可能会有帮助哦
[ 本帖最后由 wangzhonnew 于 2008-1-20 03:19 编辑 ]