- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
6#
发表于 2012-5-2 10:40:39
就症结来看 是SQL语句存在优化空间,大多都Buffer Gets过高 这意味着大量的逻辑读
Logical reads: 952,053.46 511,723.68
在其中一个AWR中 每秒逻辑读 达到 7G
buffer gets 较高 存在优化的SQL包括:
SQL ordered by Gets
Resources reported for PL/SQL code includes the resources used by all SQL statements called by the code.
Total Buffer Gets: 1,733,719,818
Captured SQL account for 42.9% of Total
Buffer Gets Executions Gets per Exec %Total CPU Time (s) Elapsed Time (s) SQL Id SQL Module SQL Text
150,857,840 6 25,142,973.33 8.70 1296.33 1769.90 gmm6ktqrft6n1 select rowid, title, filep...
57,452,737 234 245,524.52 3.31 676.45 678.49 06r32459s5kzc select rowid, ArticleID, S...
50,264,264 2 25,132,132.00 2.90 311.70 329.90 731rq4a5rd9by select rowid, title, filep...
28,441,522 2 14,220,761.00 1.64 310.11 570.12 bxa7c0y5p6smg select rowid, title, filep...
28,440,949 2 14,220,474.50 1.64 279.11 464.68 68pwkvkgs7taj select rowid, title, filep...
28,433,242 2 14,216,621.00 1.64 234.45 391.91 f442cdh9hp6sk select rowid, title, filep...
粗略看 可能是因为 希望执行计划准确 而没有去绑定变量
这里考虑到 无法修改SQL 语句, 但是 有没有想过 通过其他手段(不修改语句 添加hint)而 改善其执行计划?
Segments by Logical Reads
Total Logical Reads: 1,733,719,818
Captured Segments account for 98.8% of Total
Owner Tablespace Name Object Name Subobject Name Obj. Type Logical Reads %Total
JSCMS JSCMS INFO_KEYWORD INDEX 1,159,873,824 66.90
JSCMS JSCMS PKKEY_ARTICLE INDEX 215,263,104 12.42
JSCMS JSCMS ARTICLE SYS_P76 TABLE PARTITION 198,657,088 11.46
逻辑较高的 segment 包括 INFO_KEYWORD 和 PKKEY_ARTICLE 把他们 移动到 block size的 非标准表空间上确实可以一定程度缓解 对这个segment 上buffer的交叉访问争用 , 但是 使用 16KB的block size意味着 数据行的分布更为集中 , 这可能导致段内buffer的争用加剧 。
建议:
1. 考虑在 不修改SQL文本 的情况下 调优SQL ,包括使用SQL Profile等技术
2. 考试使用 global hash index ,当然hash index不是一定能缓解cbc
3. 内存允许的话 可以吧 一个索引 keep到 db cache keep pool中(而非16k pool),另一个使用 4k pool
一些Cache buffer chains相关的master Notes:
ODM FINDING:
Cache Buffers Chains Latch waits are caused by contention where multiple sessions waiting to read the same block.
Typical solutions are:-
o Look for SQL that accesses the blocks in question and determine if the repeated reads are necessary.
o Check for suboptimal SQL (this is the most common cause of the events) - look at the execution plan for the
SQL being run and try to reduce the gets per executions which will minimise the number of blocks being accessed
and therefore reduce the chances of multiple sessions contending for the same block
Note 34405.1 WAITEVENT: "buffer busy waits" Reference Note
@Note 42152.1 LATCH: CACHE BUFFERS CHAINS
Note 155971.1 Ext/Pub Resolving Intense and "Random" Buffer Busy Wait Performance Problems:
Note 163424.1 Ext/Pub How To Identify a Hot Block Within The Database Buffer Cache.:
These queries would benefit from tuning. They either do too much buffer gets (logical reads) per execution or just do a lot of buffer gets. Tuning these queries would lower the load on the CPU and reduce the CPU wait time. Check if all objects in these queries have representative and up to date stats present. Also check if all the indexes are present.
If a query does not do an excessive amount of gets for 1 run but when the query runs often, then lowering the amount of buffer gets per run with for example 10% will have a big impact overall.
To see the full SQL open the html AWR report and select SQL Statistics in the Main Report section, then select SQL ordered by Gets clicking on the SQL id then gives the complete statement. |
|