Starting from:

$29.99

DSCI551 HW4-Indexing and Query Execution Solution

(Indexing and Query Execution)
1. Consider the following B+tree for the search key “age. Suppose the degree d of the tree = 2, that is, each node (except for root) must have at least two keys and at most 4 keys. Note that sibling nodes are nodes with the same parent.

a. [10 points] Describe the process of finding keys for the query condition “age >= 35 and age <= 65”. How many blocks I/O’s are needed for the process?
b. [15 points] Draw the B+-tree after inserting 14, 15, and 16 into the tree. Only need to show the final tree after all insertions.
c. [15 points] Draw the tree after deleting 2 from the original tree.
2. [60 points] Consider natural-joining tables R(a, b) and S(a,c). Suppose we have the following scenario.
i. R is a clustered relation with 5,000 blocks. ii. S is a clustered relation with 20,000 blocks. iii. 102 pages available in main memory for the join. iv. Assume the output of join is given to the next operator in the query execution plan (instead of writing to the disk) and thus the cost of writing the output is ignored.
Describe the steps for each of the following join algorithms. For sorting and hashingbased algorithms, also indicate the sizes of output from each step. What is the total number of block I/O’s needed for each algorithm? Which algorithm is most efficient in terms of block’s I/O?
a. [10 points] (Block-based) nested-loop join with R as the outer relation.
b. [10 points] (Block-based) nested-loop join with S as the outer relation.
c. [20 points] Sort-merge join (assume only 100 pages are used for sorting and 101 pages for merging). Note that if join can not be done by using only a single merging pass, runs from one or both relations need to be further merged, in order to reduce the number of runs. Select the relation with a larger number of runs for further merging first if both have too many runs.
d. [20 points] Partitioned-hash join (assume 101 pages used in partitioning of relations and no hash table is used to lookup in joining tuples).
Submission:
A pdf file.

More products