B树叶子节点split
一、B-Tree索引的分裂
1. 创建测试表
SQL> create table split_tab (id number, name varchar2(100));
表已创建。
SQL> alter table split_tab add constraint pk_split_tab primary key (id) using index;
表已更改。
SQL> create sequence seq_alex_tab
2 minvalue 1
3 maxvalue 99999999
4 start with 1
5 increment by 1
6 cache 200;
序列已创建。 2. 插入1万条数据
SQL> declare
begin
for i in 1..10000 loop
insert into split_tab values (i, 'split');
end loop;
commit;
end; 2 3 4 5 6 7
8 / 3.搜集下统计信息:
BEGIN
DBMS_STATS.GATHER_TABLE_STATS(ownname => 'SCOTT',
tabname => 'SPLIT_TAB',
estimate_percent => 30,
method_opt => 'for all columns size repeat',
no_invalidate => FALSE,
degree => 8,
cascade => TRUE);
END; 3. 分析一下索引结构
SQL> col ratio for a20
SQL> col segment_name for a30
SQL> analyze index PK_ALEX_TAB validate structure;
索引已分析
SQL> select height,round((del_lf_rows_len/lf_rows_len)*100,2)||'%' ratio,pct_used from index_stats where name= 'PK_ALEX_TAB';
HEIGHT RATIO PCT_USED
---------- -------------------- ----------
2 0% 93
SQL> select segment_name,bytes from user_segments where segment_name='PK_ALEX_TAB';
SEGMENT_NAME BYTES
------------------------------ ----------
PK_ALEX_TAB 196608
SQL> select pct_free from user_indexes where index_name='PK_ALEX_TAB';
PCT_FREE
----------
10 4. DUMP出主键索引的索引树结构
SQL> select data_object_id,object_id from dba_objects where owner='SCOTT' and object_name='PK_SPLIT_TAB'; DATA_OBJECT_ID OBJECT_ID
-------------- ----------
75152 75152 SQL> alter session set events 'immediate trace name treedump level 75152';
会话已更改。 5. DUMP日志分析
----- begin tree dump
branch: 0x10206c3 16910019 (0: nrow: 18, level: 1)
leaf: 0x10206c5 16910021 (-1: nrow: 578 rrow: 578)
leaf: 0x10206c6 16910022 (0: nrow: 571 rrow: 571)
leaf: 0x10206c7 16910023 (1: nrow: 571 rrow: 571)
leaf: 0x10206c4 16910020 (2: nrow: 571 rrow: 571)
leaf: 0x10206cd 16910029 (3: nrow: 571 rrow: 571)
leaf: 0x10206ce 16910030 (4: nrow: 571 rrow: 571)
leaf: 0x10206cf 16910031 (5: nrow: 571 rrow: 571)
leaf: 0x10206c8 16910024 (6: nrow: 571 rrow: 571)
leaf: 0x10206c9 16910025 (7: nrow: 571 rrow: 571)
leaf: 0x10206ca 16910026 (8: nrow: 571 rrow: 571)
leaf: 0x10206cb 16910027 (9: nrow: 571 rrow: 571)
leaf: 0x10206cc 16910028 (10: nrow: 571 rrow: 571)
leaf: 0x10206e1 16910049 (11: nrow: 571 rrow: 571)
leaf: 0x10206e2 16910050 (12: nrow: 571 rrow: 571)
leaf: 0x10206e5 16910053 (13: nrow: 571 rrow: 571)
leaf: 0x10206e6 16910054 (14: nrow: 571 rrow: 571)
leaf: 0x10206e7 16910055 (15: nrow: 571 rrow: 571)
leaf: 0x10206e3 16910051 (16: nrow: 286 rrow: 286)
----- end tree dump 6. 小结
(1)可以看到主键索引只在以下叶块上进行分裂,即最右侧的叶块上进行分裂:
leaf: 0x10206e3 16910051 (16: nrow: 286 rrow: 286)
B树叶子节点split的更多相关文章
- 获取所有树叶子节点 注册添加事件 if ($(node).tree('isLeaf', node.target)) 是否叶子节点
//获取所有树叶子节点 注册添加事件 if ($(node).tree('isLeaf', node.target)) 是否叶子节点 $(function () { $('.easyui-tree') ...
- ztree树 叶子节点路径的集合
1.Question Description: ztree树各个节点都带有路径,如“/根节点”,"/根节点/一级节点",“根节点/一级节点/二级节点‘; 现在想获取所选的最末级节点 ...
- B+树叶子节点数据如何存储,以及如何查找某一条数据
MySQL索引背后的数据结构及算法原理 https://www.kancloud.cn/kancloud/theory-of-mysql-index 非常好 根据一条sql 如何查看索引结构等信息 ...
- GEF中TreeViewer的叶子节点展开
/** * GEF树叶子节点的展开 * @param items */ private void expand(TreeItem[] items) { for (int i = 0; i < i ...
- POJ 3277 City Horizon(叶子节点为[a,a+1)的线段树+离散化)
网上还有用unique函数和lowerbound函数离散的方法,可以百度搜下题解就有. 这里给出介绍unique函数的链接:http://www.cnblogs.com/zhangshu/archiv ...
- 树 List Leaves 【用数组模拟了树状结构建树+搜索叶子节点+按照特殊规律输出每个叶子节点】
Given a tree, you are supposed to list all the leaves in the order of top down, and left to right. I ...
- 先序遍历创建二叉树,对二叉树统计叶子节点个数和统计深度(创建二叉树时#代表空树,序列不能有误)c语言
#include "stdio.h" #include "string.h" #include "malloc.h" #define NUL ...
- [二叉树算法]让树所有叶子节点连成一个单链表,让rchild作为 next指针
//让树所有叶子节点连成一个单链表,让rchild作为 next指针 LNode *head=null,*pre=null;//全局变量 LNode *InOrder(BTNode *T){ if(T ...
- HDU 4267 线段树 离散点区间更新, 自叶子节点至根单点查询
题意: n个数字 下面n个数字表示数列 2个操作 1 [u, v] k add [u,v ]区间 (u点要计算)每隔k个位置,该数字+add 2 pos 询问 pos下标的值(下标从1开始) 思路 ...
随机推荐
- ie版本判断的js hack
常用来判断各种浏览器版本的 ie js hack如下: 1. <!–[if !IE]><!–> 除IE外都可识别 <!–<![endif]–> 2. < ...
- [LeetCode] 230. Kth Smallest Element in a BST 解题思路
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Not ...
- mysql 索引相关知识
由where 1 =1 引发的思考 最近工作上被说了 说代码中不能用 where 1=1,当时觉得是应该可以用的,但是找不到什么理据, 而且mysql 语句优化这方面确实很薄弱 感觉自己mysql ...
- IT项目外包有哪些注意事项
2015年两会上,李克强总理在政府工作报告中首次提出“互联网+”计划,各种互联网创业项目也如雨后春笋般破土而出.由于很多创业团队并没有自己的技术团队,所以软件外包成为很多创业项目普遍采取的一种方案.在 ...
- 简单JVM思维导图
- activity theme parent 属性浅析
在AndroidManifest.xml文件中,可以对每一个Activity设置android:themetheme的设置 可以设置为系统自带的格式,也可以自定义格式. A: 系统自带格式 1.and ...
- Oracle_Q&A_03
1.先导入SQL文件 执行语句查看表信息 select * from student;--学生信息--(stunum,stuname,classid)select * from class;--班级信 ...
- java jodd轻量级开发框架
http://git.oschina.net/huangyong/jodd_demo/blob/master/jodd-example/src/main/java/jodd/example/servi ...
- Qt QString to char*
QString转换成char * 的时候,一定要定义一个QBateArray的变量.不能连写 How can I convert a QString to char* and vice versa ? ...
- Ubuntu网络管理
1.重启NetworkManager service network-manager stop rm /var/lib/NetworkManager/NetworkManager.state serv ...