11. Maintaining Storage Structures : Modify Procedures : Remodifying B-tree Tables : Examples: Remodifying a Table to B-tree
 
Share this page                  
Examples: Remodifying a Table to B-tree
The first example represents the table before modification, and the second example shows it after modification.
The following retrieval touches all three data pages before modification but only one page after modification:
select * from emp where emp.age = 35;
The following table shows the leaf and data pages prior to modification. The records with a key of 35 are found on several data pages:
Leaf Page
key   page,row (tid)
35    1,2 (514)
35    2,2 (1026)
35    3,3 (1539)
36    2,3 (1027)
37    3,2 (1538)
Data Pages 
Page 1         Page 2          Page 3
1,1 (513) 29   2,1 (1025) 29   3,1 (1537) 30
1,2 (514) 35   2,2 (1026) 35   3,2 (1538) 37
1,3 (515) 30   2,3 (1027) 36   3,3 (1539) 35
The following example modifies the emp table, re-specifying B-tree as its structure:
modify to btree on age;
In VDBA:
1. Open the Structure of Table dialog for the table.
2. Select B-tree from the Structure drop-down list.
3. Enable the age column in the Columns list.
After you perform this modification, the table looks as follows. All records with a key of 35 are clustered together on Page 2:
Page 1         Page 2          Page 3
1,1 (513) 29   2,1 (1025) 35   3,1 (1537) 36
1,2 (514) 29   2,2 (1026) 35   3,2 (1538) 37
1,3 (515) 30   2,3 (1027) 35