Download presentation
Presentation is loading. Please wait.
Published byMarylou Snow Modified over 9 years ago
1
CSCI 4333 Database Design and Implementation – Exercise (5) Xiang Lian The University of Texas – Pan American Edinburg, TX 78539 lianx@utpa.edu 1
2
I/O Cost of Accessing Files Assume that a data file has 500 pages Each page can store 50 index entries or 10 tuples A range query returns 20 tuples What is the I/O cost of accessing files/index? (assuming log 2 500 = 9) – Heap file I/O cost for index entries: I/O cost for tuples: – Sorted file – Unclustered index – Clustered index 2
3
Sparse Index vs Dense Index Which is space index? Which is dense index? 3
4
B + -Tree Index Insert tuples with key 23* 4 Root 19 24 33 2* 3*5* 7*14*16* 19*20* 22*24*27* 29*33*34* 38* 39* 14
5
B + -Tree Index (cont'd) Insert tuples with key 8* 5 Root 19 24 33 2* 3*5* 7*14*16* 19*20* 22*24*27* 29*33*34* 38* 39* 14 23*
6
B + -Tree Index (cont'd) Insert tuples with key 8* (Please complete empty index entries) 6 Root 19 24 33 2* 3*5* 7*14*16* 19*20* 22*24*27* 29*33*34* 38* 39* 14 23* Root 24 33 19*20*22*24*27* 29*33*34* 38* 39*
7
B + -Tree Index (cont'd) Insert tuples with key 8* 7 Root 19 24 33 2* 3*5* 7*14*16* 19*20* 22*24*27* 29*33*34* 38* 39* 14 23* 2*3* Root 19 24 33 14*16* 19*20*22*24*27* 29*33*34* 38* 39* 145 7*5*8*
8
Extendible Hash Index (1) Insert 2 8 h(2) = 00010 2 01 00 11 10 1620 2 1 2 2 Directory Buckets 37 2 A B C D 18
9
Extendible Hash Index (2) Insert 19 9 h(1) = 00001 h(2) = 00010 h(3) = 00011 h(7) = 00111 h(16) = 10000 h(18) = 10010 h(19) = 10011 h(20) = 10100 2 01 00 11 10 1620 2 1 2 2 2 Directory Buckets 37 2 A B C D 18
10
Extendible Hash Index (3) Insert 19 10 h(1) = 00001 h(2) = 00010 h(3) = 00011 h(7) = 00111 h(16) = 10000 h(18) = 10010 h(19) = 10011 h(20) = 10100 3 001 000 011 010 1620 2 1 2 2 2 Directory Buckets 3 A B C D 18 101 100 111 110 3
11
11
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.