Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSCI 4333 Database Design and Implementation – Exercise (5)

Similar presentations


Presentation on theme: "CSCI 4333 Database Design and Implementation – Exercise (5)"— Presentation transcript:

1 CSCI 4333 Database Design and Implementation – Exercise (5)
Xiang Lian The University of Texas – Pan American Edinburg, TX 78539

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 log2500 = 9) Heap file I/O cost for index entries: I/O cost for tuples: Sorted file Unclustered index Clustered index

3 Sparse Index vs Dense Index
Which is space index? Which is dense index?

4 B+-Tree Index Insert tuples with key 23* 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* 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) 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* Root 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* 14 5 7* 5* 8*

8 Extendible Hash Index (1)
2 01 00 11 10 16 20 1 Directory Buckets 3 7 A B C D Insert 2 h(2) = 00010 18

9 Extendible Hash Index (2)
01 00 11 10 16 20 1 Directory Buckets 3 7 A B C D Insert 19 h(1) = 00001 h(2) = 00010 h(3) = 00011 h(7) = 00111 h(16) = 10000 h(18) = 10010 h(19) = 10011 h(20) = 10100 18

10 Extendible Hash Index (3)
2 16 20 A B C D Insert 19 3 000 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 001 1 010 011 2 2 100 18 101 3 110 111 3 Directory Buckets

11


Download ppt "CSCI 4333 Database Design and Implementation – Exercise (5)"

Similar presentations


Ads by Google