Long time do not touch the database of the bottom details of things, a few days ago, a little guy came to me, not to say compound B*tree Index branch block contains only the pilot column key information, does not contain non-pilot column key value information, but also dump the branch block, to prove his statement, From common sense and SQL statement execution information can be known that his statement is problematic, but how to prove it? In order to prove this, also trouble once, play for years do not touch dump. Here are the two dump results (one for single-key indexes and the other for composite indexes) that he proves his point of view:
The following is my test process and results:
CREATE TABLE T1 (C1 int,c2 int,c3 int,c4 char (+), C5 char (2000));
CREATE index t1_idx1 on T1 (C1,C2,C3,C4,C5);
Begin
For I in 1..1000 loop
INSERT into T1 values (0,0,i, ' AA ', ' AA ');
End Loop;
End
/
Begin
For I in 1001..2000 loop
INSERT into T1 values (0,i,i, ' BB ', ' BB ');
End Loop;
End
/
Select segment_name,file_id,block_id
From Dba_extents
where Segment_name= ' t1_idx1 '
and extent_id=0;
Alter system dump DATAFILE 4 block 195;
TRC file content:
Thus, the composite B*tree Index branch block, sometimes does not contain non-pilot column key values, but sometimes contains. So, under what circumstances does it include, and under what circumstances? The experimental result is that when the selection of the Pilot column key is good enough, it is not necessary to include the key value of the non-pilot column, otherwise, it is also a waste of Branck block valuable space; only if the key value of the pilot column is not selective enough, the key value of the non-pilot column must be combined to locate the next block. To include non-pilot column of the key value, the test process omitted here, interested students can follow this idea to test themselves.
Oracle Composite B*TREE Index Branch contains non-pilot column key values within the block?