文章作者 100test 发表时间 2007:11:28 13:31:18
来源 100Test.Com百考试题网
我们知道,Oracle允许对B*Tree索引进行转储,用来显示"B*Tree"的层次结构。下面我们来介绍一个具体的实例以此来进行细化的分析:
◆首先我们需要选择要研究的索引
SQL> 0select index_name from user_indexes where index_name= I_BD_INVMANDOC_TS . INDEX_NAME ------------------------------ I_BD_INVMANDOC_TS |
◆然后再找到此索引的"object_id"
SQL> 0select object_id from dba_objects where object_name= I_BD_INVMANDOC_TS . OBJECT_ID ---------- 6393 |
◆此时转储该索引结构
SQL> ALTER SESSION SET EVENTS immediate trace name TREEDUMP level 6393 . Session altered. |
◆下面是trace文件中的片断,我们可以观察到到该索引共有三个层次,每个leaf上约有341条记录。
*** 2005-02-26 10:52:11.458 ----- begin tree dump branch: 0x1403d9c 20987292 (0: nrow: 5, level: 2) branch: 0x1403f07 20987655 (-1: nrow: 351, level: 1) leaf: 0x1403d9d 20987293 (-1: nrow: 341 rrow: 341) leaf: 0x1403d9e 20987294 (0: nrow: 341 rrow: 341) leaf: 0x1403d9f 20987295 (1: nrow: 341 rrow: 341) ...... leaf: 0x1403f00 20987648 (344: nrow: 341 rrow: 341) leaf: 0x1403f01 20987649 (345: nrow: 341 rrow: 341) leaf: 0x1403f02 20987650 (346: nrow: 341 rrow: 341) leaf: 0x1403f03 20987651 (347: nrow: 341 rrow: 341) leaf: 0x1403f04 20987652 (348: nrow: 341 rrow: 341) leaf: 0x1403f05 20987653 (349: nrow: 341 rrow: 341) branch: 0x140406c 20988012 (0: nrow: 350, level: 1) leaf: 0x1403f06 20987654 (-1: nrow: 341 rrow: 341) leaf: 0x1403f08 20987656 (0: nrow: 341 rrow: 341) leaf: 0x1403f0a 20987658 (1: nrow: 341 rrow: 341) leaf: 0x1403f0b 20987659 (2: nrow: 341 rrow: 341) leaf: 0x1403f0c 20987660 (3: nrow: 341 rrow: 341) leaf: 0x1403f0d 20987661 (4: nrow: 341 rrow: 341) ... leaf: 0x1404067 20988007 (345: nrow: 341 rrow: 341) leaf: 0x1404068 20988008 (346: nrow: 341 rrow: 341) leaf: 0x1404069 20988009 (347: nrow: 341 rrow: 341) leaf: 0x140406a 20988010 (348: nrow: 341 rrow: 341) branch: 0x14041d1 20988369 (1: nrow: 350, level: 1) leaf: 0x140406b 20988011 (-1: nrow: 341 rrow: 341) leaf: 0x140406d 20988013 (0: nrow: 341 rrow: 341) leaf: 0x140406e 20988014 (1: nrow: 341 rrow: 341) ... leaf: 0x14041ce 20988366 (347: nrow: 341 rrow: 341) leaf: 0x14041cf 20988367 (348: nrow: 341 rrow: 341) branch: 0x1404336 20988726 (2: nrow: 351, level: 1) leaf: 0x14041d0 20988368 (-1: nrow: 341 rrow: 341) leaf: 0x14041d2 20988370 (0: nrow: 341 rrow: 341) leaf: 0x14041d3 20988371 (1: nrow: 341 rrow: 341) ... leaf: 0x1404332 20988722 (347: nrow: 341 rrow: 341) leaf: 0x1404333 20988723 (348: nrow: 341 rrow: 341) leaf: 0x1404334 20988724 (349: nrow: 341 rrow: 341) branch: 0x140446f 20989039 (3: nrow: 308, level: 1) leaf: 0x1404335 20988725 (-1: nrow: 341 rrow: 341) leaf: 0x1404337 20988727 (0: nrow: 341 rrow: 341) leaf: 0x1404338 20988728 (1: nrow: 341 rrow: 341) leaf: 0x1404339 20988729 (2: nrow: 341 rrow: 341) ... leaf: 0x140446c 20989036 (304: nrow: 341 rrow: 341) leaf: 0x140446d 20989037 (305: nrow: 341 rrow: 341) leaf: 0x140446e 20989038 (306: nrow: 73 rrow: 73) ----- end tree dump |
注释:通过以上这个跟踪我们可以很清楚的看到B*Tree索引的结构,同时也有助于加深对B*Tree索引的理解。
相关文章
转储B*Tree索引的分支结构
PL_SQL中的多进程通信技术
OracleDataConvertion简单方法
使用oraclesqlloader批量导入数据
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛