latch -buffer busy wait 之索引数据块争用导致热块
来源:互联网 发布:应该数控铣床编程书籍 编辑:程序博客网 时间:2024/05/17 01:32
oracle数据库会自动为主键列创建索引。索引或递增或递减(类似序列)结构为b-tree索引,这些键值比较接近,存储在数据块上也比较靠近
随着数据量的增大b-tree索引的层级也不断增大。
在rac环境中,用户从不同实例向表中插入主键时,有相同索引数据块在不同实例内存中被调用,形成一种数据块的争用。
如数据块1被使用,其上存储了主键键值为1,2,3,等行信息,这样访问1个块导致其他行不能被其他实例访问
SQL> create table t as select * from dba_objects;
Table created.
SQL> create index t_inx on t (object_id);
Index created.
SQL> exec dbms_stats.gather_table_stats(user,'t',cascade=>true);
PL/SQL procedure successfully completed.
SQL> create table t1 as select rownum id from dba_objects;
Table created.
SQL> create index t1_inx on t1 (id) reverse;
Index created.
SQL> exec dbms_stats.gather_table_stats(user,'t1',cascade=>true);
PL/SQL procedure successfully completed.
SQL> set autotrace trace exp;
SQL> select * from t where object_id>12340 and object_id<12350;
Execution Plan
----------------------------------------------------------
Plan hash value: 1579008347
--------------------------------------------------------------------------------
-----
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time
|
--------------------------------------------------------------------------------
-----
| 0 | SELECT STATEMENT | | 10 | 930 | 3 (0)| 00:00
:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| T | 10 | 930 | 3 (0)| 00:00
:01 |
|* 2 | INDEX RANGE SCAN | T_INX | 10 | | 2 (0)| 00:00
:01 |
--------------------------------------------------------------------------------
-----
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("OBJECT_ID">12340 AND "OBJECT_ID"<12350)
SQL> select * from t1 where id>12340 and id<12350;
Execution Plan
----------------------------------------------------------
Plan hash value: 3617692013
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 10 | 40 | 19 (6)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T1 | 10 | 40 | 19 (6)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("ID"<12350 AND "ID">12340)
SQL> select /*+ index(t1,t1_inx) */* from t1 where id>12340 and id<12350;
Execution Plan
----------------------------------------------------------
Plan hash value: 3995001570
---------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
---------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 10 | 40 | 113 (2)| 00:00:02 |
|* 1 | INDEX FULL SCAN | T1_INX | 10 | 40 | 113 (2)| 00:00:02 |
---------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("ID"<12350 AND "ID">12340)
反向索引有很大局限性,只适合rac这种环境,毕竟index range scan 不能正常扫描,强制走索引也是全索引扫描,代价比较大。
- latch -buffer busy wait 之索引数据块争用导致热块
- latch -buffer busy wait 之表数据块争用导致热块
- 模拟产生CBC LATCH与buffer busy wait等待事件
- Oracle : buffer busy wait
- Buffer busy wait与latch :cache buffers chains有何联系?
- Latch工作原理,buffer busy waits,cache buffer chain
- 找到RAC中导致gc buffer busy等待事件的热点块
- buffer busy wait - file header block
- Common Wait Events---buffer busy waits
- Oracle wait event --- buffer busy waits
- 高级OWI与ORACLE性能调整读书笔记之UPDATE/UPADTE引起的buffer busy wait
- 移动项目中buffer busy wait案例解析
- 并发update/update引起的buffer busy wait
- latch free、buffer latch!
- latch: cache buffers chains-热块的简单模拟实验
- AWR实战分析之----buffer busy waits
- beego使用orm插入大量数据,回滚报错:buffer busy
- oracle等待事件4——buffer busy wait 特别介绍
- GDB调试命令
- 求list倒数value
- runtime解析json数据
- JavaSE入门学习48:Socket网络通信编程(二)
- Nginx负载均衡配置实例详解
- latch -buffer busy wait 之索引数据块争用导致热块
- es查看索引的存储范例
- JavaSE入门学习47:Socket网络通信编程(一)
- 关于安卓图片的问题
- App Bar Google官方课程翻译
- Retrofit--合理封装回调能让你的项目高逼格
- comparator接口与Comparable接口的区别
- DES——数据加密算法(变体3DES)
- BTree和B+Tree详解