Question: Part C: Relational Algebra & Heuristic Optimization [ 2 0 Marks ] Question 4 . Consider the relations: EMPLOYEE ( ID , SURNAME, LINE
Part C: Relational Algebra & Heuristic Optimization Marks
Question
Consider the relations:
EMPLOYEEID SURNAME, LINEID
CAREID MAKE
For each employee, we store their unique ID and the ID of their line manager if exists LINEID If an employee has a line manager then the corresponding LINEID is not NULL. A line manager does not have a line manager, ie the corresponding LINEID is NULL. The LINEID is a foreign key referencing to the ID primary key in the relation Employee. In the relation Car, we store the cars make of an employee, if exists Specifically, for each car, we store its make eg BMW Jaguar, Aston Martin, Toyota and the ID of its owneremployee EID The EID is a foreign key referencing to the ID in the relation Employee. The primary keys are underlined.
Assume the following query:
SELECT ESURNAME, LSURNAME
FROM EMPLOYEE E EMPLOYEE L CAR C
WHERE ELINEID LID AND CEID LID
We know that: i there are line managers, each one being the line manager of employees;
ii there are employees, who have car each, ie the CAR relation has tuples, each one corresponds to different employee.
a Provide the canonical tree of the query and estimate the expected number of tuples retrieved.
b Optimize the query using heuristic optimization by providing the optimal tree. Show and explain the heuristic rules you used.
c Provide the optimal relational algebra expression from the Question b
d Estimate the expected number of tuples retrieved at each operator in your optimal tree from the Question b Compare this number with the Question a
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
