(10 points) Question2 Consider the following relations Emp(eid: integer, ename:
ID: 3717805 • Letter: #
Question
(10 points) Question2 Consider the following relations Emp(eid: integer, ename: varchar, sal: integer, age: integer, did: integer) Dept(did: integer, budget: integer, floor: integer, mgr eid: integer) Salaries range from $10,000 to $100,000, ages vary from 20 to 80, each department has about five employees on average, there are 10 floors, and budgets vary from $10,000 to $1 million. You can assume uniform distributions of values. For each of the following queries, which of the listed index choices would you choose to speed up the query? If your database system does not consider index-only plans (i.e., data records are always retrieved even if enough information is available in the index entry), how would your answer change? 1. Query: Print ename, age, and sal for all employees. (a) Clustered hash index on fields of Emp (b) Clustered B+ tree index on fields of Emp (c) Unclustered hash index on fields of Emp (d) Unclustered hash index on fields of Emp (e) No index. 2. Query: Find the dids of departments that are on the 10th floor and have a budget of less than $15,000 (a) Clustered B+ tree index on fields of Dept. (b) Clustered hash index on the floor field of Dept. (c) Unclustered hash index on the floor field of Dept. (d) Clustered B+ tree index on the budget field of Dept. (e) No index.Explanation / Answer
1. To print ename, age and salary we must get details from EMP so option (d) is not possible, next is to check clustered or unclustered, as we know that clustered index works fasrer when we have sequential data to look into. so we have as option (c) which is best i.e. Unclustered hash index on <ename, age, sal> fields of emp.
For no index plan option e is correct as it will go thorough all records thus indexing not required
2. Option a as we will have data sequentially on these fields thus clustured B+ is an option with fields floor and budget in question as all other option are indexing on one field only. There is no option which is correct for no index plan.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.