Question: Problem 5: Query Evaluation Consider the join between relations R and S, where the join condition is R.a = S.b. We are given the following

Problem 5: Query Evaluation

Consider the join between relations R and S, where the join condition is R.a = S.b.

We are given the following information about the two relations. The cost metric is the number of page I/Os, and the cost of writing out the result should be uniformly ignored.

Relation R contains 10,000 tuples and has 10 tuples per page.

Relation S contains 2,000 tuples and also has 10 tuples per page.

Attribute b of relation S is the primary key for S.

Both relations are stored as simple heap files.

Neither relation has any indexes built on it. 52 buffer pages are available.

Questions:1. What is the cost of joining R and S using a simple nested loops join?

2. What is the cost of joining R and S using a block nested loops join?

3.What is the cost of joining R and S using a sort-merge join?

4.What is the cost of joining R and S using a hash join?

5. How many tuples will the join of R and S produce, at most, and how many pages would be required to store the result of the join back on disk?

6. If secondary B+ indexes existed on R.a and S.b, would either provide a cheaper alternative for performing the join (using an index nested loops join) than a block nested loops join?

7. Explain. If primary B+ indexes existed on R.a and S.b, would either provide a cheaper alternative for performing the join (using the index nested loops algorithm) than a block nested loops join? Explain.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!