Uploaded by Oluwatomiwa Jinadu

ADVDBAssignement3 Spr23

advertisement
Assignment 1
Advanced Databases
COMP4200
Spring, 2023
Description
This assignment comprises two tasks.
Task 1 is based on the employees database that we have downloaded and installed on
our MySQL DBMS.
Task 2 is about transactions and is not dependent upon any schema.
Task 1 (70 points)
Let us say that the company who owns the employees database needs to run the
following query on a regular basis select * from employees e
join salaries s
on e.emp_no=s.emp_no
join dept_emp de
on de.emp_no=e.emp_no
join departments d
on d.dept_no=de.dept_no
where year(s.from_date) between year(de.from_date) and year(de.to_date)
order by e.first_name, s.from_date;
On my system, the query takes about 14 seconds, which is not satisfactory. You have
to use indexes to speed up the query without having too much impact on other
activities. We do know that using too many indices may have adverse effects.
You must choose which data column/columns you can index on to speed up the query.
Then create those indexes. But before you create index or indexes, run the query and
create a screenshot of it that shows the query and the time in your workbench.
After you create the index or indexes, you must run the query again and take another
screenshot to show if there are any performance gains.
If you create more than one index, then monitor query performance after you create
each index (keep screenshot) so that you can tell if any of the indices are actually
helping.
Answer the following questions 1. What is the highest performance increase could you get?
2. Can you identify where the bottleneck is? Hint: try running the query part by part.
3. Why is the bottleneck a bottleneck in this case?
4. Is there anything we can do to remove that bottleneck?
Task 2 (30 points)
We have the following two transactions T1: SELECT X → UPDATE X → SELECT Y → UPDATE Y
T2: SELECT Y → UPDATE Y
Are these two transactions serializable? Why or why not? Explain your answer
adequately.
Submission guidelines
You must put all the following information in a pdf and upload it 1. Task 1 a. all the screenshots that show performance of the query both before and
after your performance tuning.
b. All the index creation queries
c. Answers to all the questions posed at the end of the task.
2. Task 2 - answer to the questions posed in task 2.
The name of the PDF must follow the format
ADVDB_Assign3_Firstname_lastname.pdf where first name and last name are
your first name and last name :)
Download