Presentation is loading. Please wait.

Presentation is loading. Please wait.

Index Structure for Files.

Similar presentations


Presentation on theme: "Index Structure for Files."— Presentation transcript:

1 Index Structure for Files

2 Secondary Global Allocation Map
Index Allocation Map (IAM) for table 1 Headers PFS Page Free space GAM Global Allocation Map SGAM Secondary Global Allocation Map Start of table 1 Index Allocation Map (IAM) for table 2 Start of table 2 Index Allocation Map (IAM) for index 90 Start of index 90

3 Cash 1 2 Write-ahead Log 3 4 5 6 Flushing Database T1 x 5 89 T1 y 15 9
T w …………….. …………….. …………….. …………….. Clean Pages …………….. …………….. …………….. …………….. …………….. Check Point MinLSN Flushing Dirty pages Database

4 This is the primary key DeptId Name EmpId
Data File – DeptId is the Clustering key Field DeptId Name EmpId 1 Jack 101 Index File 1 Steve 102 1 1 John 103 This is the primary key 2 1 Nancy 104 3 2 Rose 105 2 Abdul 106 2 Pat 107 3 Melissa 108 3 Joe 109

5 DeptId Name EmpId null pointer null pointer null pointer
Data File – DeptId is the Clustering key Field DeptId Name EmpId 1 Jack 101 Index File 1 Steve 102 1 1 John 103 2 1 Nancy 104 3 1 David 112 2 Rose 105 2 Abdul 106 2 Pat 107 null pointer null pointer 3 Melissa 108 3 Joe 109 null pointer

6 Example of a B-Tree of order 3
We want to insert the following records into a B-tree of order 3 2 Jack 30,000 80 Steve 32,000 8 John 50,000 71 Nancy 55,000 15 Rose 90,000 63 Abdul 35,000 90 Pat 42,000 55 Kathy 45,000 35 Melissa 38,000 51 Joe 39,000 EmpId Name Salary

7 Insert index for record:
2 Jack 30,000 Null Pointer Before After 2

8 Insert index for record:
80 Steve 32,000 Before 2 After 2 80

9 Insert index for record:
8 John 50,000 Before 2 80 After 8 2 80

10 Insert index for record:
71 Nancy 55,000 Before 8 2 80 After 8 2 71 80

11 Insert index for record:
15 Rose 90,000 Before 8 2 71 80 After 8 2 15 80 71

12 Insert index for record:
63 Abdul 35,000 Before 8 2 15 80 71 After 8 2 15 80 71 63

13 Insert index for record:
90 Pat 42,000 Before 8 2 15 80 71 63 After 8 2 15 80 71 63 90

14 Insert index for record:
55 Kathy 45,000 Before 8 2 15 80 71 63 90 After 55 8 71 15 63 80 90 2

15 Insert index for record:
35 Melissa 38,000 55 8 71 15 63 80 90 2 Before After 55 8 71 15 63 80 90 2 35

16 Insert index for record:
51 Joe 39,000 55 Before 8 71 2 15 35 63 80 90 55 8 71 15 63 2 80 90 51 35 After

17 EmpId Name Salary 2 Jack 30,000 80 Steve 32,000 8 John 50,000 71 Nancy
55,000 15 Rose 90,000 63 Abdul 35,000 90 Pat 42,000 55 Kathy 45,000 35 Melissa 38,000 51 Joe 39,000 EmpId Name Salary 55 8 71 15 63 2 80 90 51 35


Download ppt "Index Structure for Files."

Similar presentations


Ads by Google