Home  >  Article  >  Database  >  理解B*treeindex内部结构

理解B*treeindex内部结构

WBOY
WBOYOriginal
2016-06-07 16:06:371078browse

Oracle数据库里的B树索引就好象一棵倒长的树,它包含两种类型的数据块:一种是索引分支块,另一种是索引叶子块 索引分支块包含指向相应索引分支块/叶子块的指针和索引健值列(这里的指针是指相关分支块/叶子块的块地址RDBA。 事实上,如果使用准确的名字来描

Oracle数据库里的B树索引就好象一棵倒长的树,它包含两种类型的数据块:一种是索引分支块,另一种是索引叶子块 索引分支块包含指向相应索引分支块/叶子块的指针和索引健值列(这里的指针是指相关分支块/叶子块的块地址RDBA。

事实上,如果使用准确的名字来描述关系型数据库中的B-Tree索引,并不能称其为B-Tree索引,而应当称其为B*-Tree索引。

看下面的索引结构图:

\

/+*
drop table gyj_t1;

create table gyj_t1 (
id int,
name varchar2(100)
);



begin 
 for i in  1 .. 5000 loop
   insert into gyj_t1 values(i,'gyj'||i);
    commit;
 end loop; 
end;
/


非唯一索引
create index idx_gyj_t1 on gyj_t1(id);


唯一索引
drop index idx_gyj_t1;
create unique index idx_gyj_t1 on gyj_t1(id);


gyj@ZMDB> select object_id from dba_objects where object_name='IDX_GYJ_T1';

 OBJECT_ID
----------
     24515

gyj@ZMDB> select header_file,header_block from dba_segments where segment_name='IDX_GYJ_T1';

HEADER_FILE HEADER_BLOCK
----------- ------------
          7         2618

+/

\

 

\

ALTER SESSION SET EVENTS 'immediate trace name treedump level 24515';

----- begin tree dump

 

\

\

*********************************************************************************************转储枝块

 

\

********************************************************************************转储叶块

 

\

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Redis简述Next article:为何Redis要比Memcached好用