上篇日志提到了,那么高的负载,是存在数据块读竞争,下面介绍几个方法来消除块竟争
查找块竟争
如果查出来是相同的块或是相近的范围,这就是存在竞争的块或对象
找出对象
解决竟争
1,优化低效查询
2,重组热块数据
reinsert and delete hot row will move them to new datablock,可以减小热块提高性能,
3,调整 PCTFREE
djusting the PCTFREE value downward for an object will reduce the number of rows physically stored in a block
Note: PCTFREE is still required even with ASSM because it determines how rows will be packed into blocks, while freelists, pctused and pctincrease are ignored with ASSM because they are used for transaction/block management
4,把hot 对象移动到小block size tablespace中 如 2k block size
5,优化索引
a low cardinality index has a relatively small number of unique values, e.g. a column containing state data with only 50 values. Similar to inefficient queries, the use of a low cardinality index could cause excessive number of blocks to be read into the buffer cache and cause premature aging out of "good" blocks
6,反转索引优化 减小index block 竟争
7,cluster hash table, hash partition table 来打算数据
查找块竟争
SELECT p1 "file#", p2 "block#", p3 "class#"
FROM v$session_wait
WHERE event = 'read by other session';复制
如果查出来是相同的块或是相近的范围,这就是存在竞争的块或对象
找出对象
SELECT relative_fno, owner, segment_name, segment_type
FROM dba_extents
WHERE file_id = &file
AND &block BETWEEN block_id AND block_id + blocks - 1;复制
解决竟争
1,优化低效查询
2,重组热块数据
reinsert and delete hot row will move them to new datablock,可以减小热块提高性能,
SELECT data_object_id
FROM dba_objects
WHERE owner='&owner' AND object_name='&object';
SELECT dbms_rowid.rowid_create(1,<data_object_id>,<relative_fno>,<block>,0) start_rowid
FROM dual;
--rowid for the first row in the block
SELECT dbms_rowid.rowid_create(1,<data_object_id>,<relative_fno>,<block>,500) end_rowid
FROM dual;
--rowid for the 500th row in the block
Insert <owner>.<segment_name>
select *
FROM <owner>.<segment_name>
WHERE rowid BETWEEN <start_rowid> AND <end_rowid>
delete FROM <owner>.<segment_name>
WHERE rowid BETWEEN <start_rowid> AND <end_rowid>复制
3,调整 PCTFREE
djusting the PCTFREE value downward for an object will reduce the number of rows physically stored in a block
Note: PCTFREE is still required even with ASSM because it determines how rows will be packed into blocks, while freelists, pctused and pctincrease are ignored with ASSM because they are used for transaction/block management
4,把hot 对象移动到小block size tablespace中 如 2k block size
5,优化索引
a low cardinality index has a relatively small number of unique values, e.g. a column containing state data with only 50 values. Similar to inefficient queries, the use of a low cardinality index could cause excessive number of blocks to be read into the buffer cache and cause premature aging out of "good" blocks
6,反转索引优化 减小index block 竟争
7,cluster hash table, hash partition table 来打算数据
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
相关阅读
Oracle RAC 一键安装翻车?手把手教你如何排错!
Lucifer三思而后行
601次阅读
2025-04-15 17:24:06
【纯干货】Oracle 19C RU 19.27 发布,如何快速升级和安装?
Lucifer三思而后行
587次阅读
2025-04-18 14:18:38
XTTS跨版本迁移升级方案(11g to 19c RAC for Linux)
zwtian
494次阅读
2025-04-08 09:12:48
Oracle数据库一键巡检并生成HTML结果,免费脚本速来下载!
陈举超
478次阅读
2025-04-20 10:07:02
【ORACLE】记录一些ORACLE的merge into语句的BUG
DarkAthena
463次阅读
2025-04-22 00:20:37
Oracle 19c RAC更换IP实战,运维必看!
szrsu
439次阅读
2025-04-08 23:57:08
【ORACLE】你以为的真的是你以为的么?--ORA-38104: Columns referenced in the ON Clause cannot be updated
DarkAthena
437次阅读
2025-04-22 00:13:51
【活动】分享你的压箱底干货文档,三篇解锁进阶奖励!
墨天轮编辑部
428次阅读
2025-04-17 17:02:24
火焰图--分析复杂SQL执行计划的利器
听见风的声音
371次阅读
2025-04-17 09:30:30
3月“墨力原创作者计划”获奖名单公布
墨天轮编辑部
360次阅读
2025-04-15 14:48:05
热门文章
移除DataGuard Standby配置导致Primary启动失败
2023-08-17 21323浏览
使用dblink产生的”SELECT /*+ FULL(P) +*/ * FROM XXXXX P ” 解析
2023-06-20 20900浏览
Troubleshooting 'ORA-28041: Authentication protocol internal error' change password 12c R2 DB
2020-04-08 13669浏览
浅谈ORACLE免费数据库Oracle Database XE (Express Edition) 版
2018-10-31 7629浏览
High wait event ‘row cache mutex’ in 12cR2、19c
2020-08-14 5592浏览