考虑表结构如下:
create table testzh(id int primary key auto_increment ,id2 int,id3 int);
插入数据:
delimiter //
create procedure ins3()
begin
declare i int;
set i=0;
while i<10000 do
insert into testzh(id2,id3) values(FLOOR((RAND()*100000)),FLOOR((RAND()*100000)));
set i=i+1;
end while;
end;
//
delimiter ;
这里仅仅考虑聚合索引的B+数结构。
首先我们要考虑2个因素:
1、分支节点如何存储一行数据
2、叶子结点如何存储一行数据
位了找到这个问题我们必须要找到哪些块是叶子结点,哪些块是非叶子结点,这里使用自己写的一个程序
找到详细参考最后的代码
(http://blog.itpub.net/7728585/viewspace-2128817/)
[root@testmy test]# ./t1 testzh.ibd
file size is 442368
Block id is 3:Index page no is 552 : B+ Tree Level is 1
Block id is 4:Index page no is 552 : B+ Tree Level is 0
Block id is 5:Index page no