Does the Compound B * tree index branch block contain non-pilot column key values?

Source: Internet
Author: User

I haven't touched the underlying details of the database for a long time. A little guy came to me a few days ago and had to say that the compound B * tree index branch block only contains the key value information of the pilot column, it does not contain the key value information of the non-pilot column, and also dump the branch block to prove his statement. It can be known from the statement execution information of common sense and SQL, he said there was a problem, but how can he prove this? To prove this, it is also a hassle to play dump without touching it for years. The following are the two dump results (one is a single-key index and the other is a composite index) that he proves his point of view ):




The following is my testing process and result:

Create Table T1 (C1 int, C2 int, C3 int, C4 char (2000), 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 (, I, 'A', 'A ');
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:


It can be seen that the compound B * tree index branch block sometimes does not contain non-pilot column key values, but sometimes does. So, under what circumstances and under what circumstances? The experiment results show that when the selection of the key values of the pilot column is good enough, you do not need to include the key values of the non-pilot column. Otherwise, it is a waste of valuable branck block space; the key value of a non-pilot column must contain the key value of a non-pilot column only when the selection of the key value of the pilot column is insufficient and must be combined with the key value of the non-pilot column to locate the next block, this test process is skipped here. Interested parties can test the test based on this idea.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.