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开始) 思路 ...
随机推荐
- INTELLIJ IDEA集成CHECKSTYLE(转)
转自:http://www.cnblogs.com/kiwi-wang/p/4166410.html 本文中使用intelliJ IDEA版本为14.0.1,其他版本差异不大,可同样安装. 下载安装C ...
- 解决Qt5.7.0 cannot find -lGL
很久没用Qt了,这次要做一个协议编辑器,在ubuntu 14.04上安装了最新版本的Qt 5.7.0.界面改用扁平化风格,第一感觉还不错.按默认步骤创建了一个gui程序,编译运行,报了一个错:cann ...
- lua面向对象封装及元表(metatable)性能测试
Lua本身是没有面向对象支持的,但面向对象编程在逻辑复杂的大型工程却很有用.于是很多人用Lua本身的数据结构table来模拟面向对象.最简单的一种方法是把对象的方法.成员都放到table中.如: -- ...
- (转)iOS如何取得APP的版本信息跟服务器对比进行升级提示?
关键是自动取版本信息: [NSString stringWithFormat:@"Version %@",[[NSBundle mainBundle] objectForInfoD ...
- Sqlserver更新数据表xml类型字段内容某个节点值的脚本
GO USE [JC2010_MAIN_DB] 1.新建备份表JobObjectVersion_JCSchemVersion_BCK) GO IF EXISTS (SELECT * FROM sys. ...
- cocos2dx 利用CCOrbitCamera实现扑克牌翻牌效果
[cpp] view plaincopy #include "HelloWorldScene.h" #include "SimpleAudioEngine.h" ...
- [ES6] Array -- Destructuring and Rest Parameters && for ..of && Arrat.find()
We can use the destructing and rest parameters at the same time when dealing with Array opration. Ex ...
- IOS开发之微博的设计与实现
// // main.m // Microblog // #import <Foundation/Foundation.h> #import "Person.h" #i ...
- 大数据笔记13:Hadoop安装之Hadoop的配置安装
1.准备Linux环境 1.0点击VMware快捷方式,右键打开文件所在位置 -> 双击vmnetcfg.exe -> VMnet1 host-only ->修改subnet ip ...
- 小学生之Java中的异常
1.异常try{ //可能出现异常的代码}catch(Exception ex){ }finally{ //释放资源}2.异常的高级应用开闭原则:对修改关闭,对新增开放3.什么是异常?解析:异常是代码 ...