Uploaded by maha burham

Assignment-2

advertisement
Database Management Systems (2)
Assignment 2
A. Consider a relation R over the attributes a, b, c with the following characteristics:
R has 5,000 records with 5 records per page
Attribute a is a primary key
Un-clustered B+ (n=5) tree index on attribute a
Clustered B+ (n=5) tree index on attribute b
Attribute b has 1,000 distinct values in R, and the values are uniformly distributed in R
Attribute c has 500 distinct values uniformly distributed in R, and an un-clustered B+ (n=5) tree index
(a) Estimate the cost of computing select * from R where a=constant_value using the index
(b) Estimate the cost of computing select * from R where b=constant_value using the index
(c) Estimate the cost of computing select * from R where a=constant_value using the index
B.
Consider the B+ tree index with n = 5 shown in the figure below.
(a) Show the tree that would result from inserting a data entry with key 9 into this tree.
(b) Show the B+ tree that would result from inserting a data entry with key 3 into the original tree.
(c) Show the B+ tree that would result from deleting the data entry with key 8 from the original tree, assuming
that the left sibling is checked for possible redistribution.
(d) Show the B+ tree that would result from deleting the data entry with key 8 from the original tree, assuming
that the right sibling is checked for possible redistribution.
(e) Show the B+ tree that would result from starting with the original tree, inserting a data entry with key 46 and
then deleting the data entry with key 52.
(f) Show the B+ tree that would result from deleting the data entry with key 91 from the original tree.
(g) Show the B+ tree that would result from starting with the original tree, inserting a data entry with key 59, and
then deleting the data entry with key 91.
(h) Show the B+ tree that would result from successively deleting the data entries with keys 32, 39, 41, 45, and 73
form the original tree.
C.
Given the following extendable dynamic hash index:
2
james
2
00
2
jones
01
10
carter
11
2
smith
The hash values are computed for different keys as follows:
K
h(K)
smith
11101
jones
010010
james
101000
carter
011010
white
001011
black
111001
brown
000110
archer
110111
smart
010101
watkins
101010
franks
110010
Draw the index after each step for the following successive steps:
1. insert white
2. insert black
3. insert brown
4. insert archer
5. insert smart
6. insert watkins
7. insert frank
8. delete smith
9. delete archer
10. delete carter
11. delete jones
Download