Question

In: Computer Science

/*explain */ Select * From Student join enrollment on student.ID = enrollment.Student_ID             join section on...

/*explain */ Select *

From Student join enrollment on student.ID = enrollment.Student_ID

            join section on section.ID = enrollment.section_ID

            join department on major = department.name

            join faculty on faculty.id = section.faculty_ID

            join address on address.id = student.address_ID

            join Course on section.course_Number = course.course_number and section.dept_id = course.dept_ID

Where

--we want to make sure we have name information for students if we want to reach out to them

Student.Name_Last Not Like ('')

-- the theater department has asked to be out of this study

and Student.Major <> 'Theater'

--no students who have failed as we're looking for passing grades

and Grade > '1.33'

--we want to make sure we only have instructors, and the theater department is not part of this study

and Faculty.job in

            (Select job

            From Faculty

            Where Job not in ('Administrative','General Services','Human Resources')

            and Dept <> 'THT')

and Section_ID >=1

--summer courses don't always reflect accurately given their tight schedule and rapid fire delivery of materials

and Semester <> 'Summer'

--we don't want bias of an adivosr giving better grades

and Student.Advisor_ID <> Section.Faculty_ID

-- we don't want bias if a student is possibly a faculty members child

and Student.Address_ID <> Faculty.Address_ID

Order by Student.Name_Last, Grade desc, Faculty.Name_Last, Major

  1. Based on the output from the explain command, determine the steps you would take (building indexes on certain columns, modifying the query, both, etc.) to get the same output, but improve overall performance.
  2. Execute three steps that you think would make for improvement in the performance of this query. Report their run time in the table below.

Evaluate the impact of the steps you took, what their potential benefits and setbacks may be, and what you would advise as the next steps to improve the performance of this query.

Solutions

Expert Solution

ANSWER:

Execute three steps that you think would make for improvement in the performance of this query.

1.While creating index, it should be taken into consideration which all columns will be used to make SQL queries and create one or more indexes on those columns. Practically, indexes are also a type of tables, which keep primary key or index field and a pointer to each record into the actual table.

eg:- CREATE UNIQUE INDEX STUDENT_INDEX ON STUDENT(ID, Last_Name, Major, Grade);

Similarly we need to create indexes for other Tables and while creating indexes mention the column names that are being used in the SQL Query.

2. We can remove unwanted Relation/Tables from the JOIN Query eg:- Address, if we arent displaying any columns related to ADDRESS Table, we can remove so that cost of JOIN Query execution will be reduced and the query will execute in relative less time.

3. We can have certain constraints in the CREATE TABLE itself so that we dont put such filters in SQL Select Query:- LAST_NAME VARCHAR2(100) NOT NULL, if we have this Constraint in CREATE TABLE STUDENT, we can avoid this WHERE clause Student.Name_Last Not Like (''). Thus we can remove unwanted filters from the Select Query so as to enable less filtering of results obtained. This can speedup Query execution.


Related Solutions

A. Rewrite the query select * from section natural join classroom without using a natural join...
A. Rewrite the query select * from section natural join classroom without using a natural join but instead using an inner join with a using condition. B. Explain the difference between integrity constraints and authorization constraints.
Write a SELECT statement that returns these columns using a JOIN of three tables: order_date from...
Write a SELECT statement that returns these columns using a JOIN of three tables: order_date from the orders table shipped_date from the orders table order_qty from the order_details table title from the items table artist from the items table unit_price from the items table Result table should be in order of order_date in ascending order
Student enrollment at a college over the past five years is given below. Year(t) Enrollment(y) 1...
Student enrollment at a college over the past five years is given below. Year(t) Enrollment(y) 1 18.9 2 23.1 3 24 4 24.6 5 26.4 Required: a. Develop a linear trend equation for this time series. b. Forecast enrollment for year 12. c. Forecast enrollment for year 15.
10. A college raises its annual tuition from $23,000 to $24,000, and its student enrollment falls...
10. A college raises its annual tuition from $23,000 to $24,000, and its student enrollment falls from 4,877 to 4,705. Compute the price elasticity of demand. (Would demand be elastic or inelastic?) a. 1.25 b. .84 c. .56 d. 2.34 11. As the price of good X rises from $10 to $12, the quantity demanded of good Y rises from 100 units to 114 units. Are X and Y substitutes or complements? What is the cross elasticity of demand? a....
1. The dean of a school of business is forecasting total student enrollment for this year...
1. The dean of a school of business is forecasting total student enrollment for this year (2019)'s summer session classes based on the following historical data: YEAR TOTAL ENROLLMENT   y 2015 2,000 2016 2,200 2017 2,800 2018 3,000   a) What is this year's forecast using a three-year simple moving average? b) What is this year's forecast using a three-year weighted moving average with weights of 0.5, 0.3, and 0.22 c) What is this year's forecast using exponential smoothing...
Student enrollment at a university over the past six years is given below.
  Student enrollment at a university over the past six years is given below. Year(t) Enrollment(In 1,000s) 1 6.30 2 7.70 3 8.00 4 8.20 5 8.80 6 8.00 What is the linear trend expression for the above time series? Select one: a. Tt = 6.63 – 0.34t b. Tt = 6.63t + 0.34 c. Tt = 6.63 + 0.34t d. Tt = 0.77 + 0.59t e. Tt = 2.06 + 1.44t Based on the model you determined in the...
An outbreak of gastroenteritis occurred at a liberal arts college with a student enrollment of 1164....
An outbreak of gastroenteritis occurred at a liberal arts college with a student enrollment of 1164. Forty-seven (47) students had sought care at the college Health Center between 10:30 p.m. on January 17 and 8:00 p.m. on January 18. The ill students seen at the Health Center all lived in dormitories totaled 756. The dormitory of residence of the 47 known cases, as well as the population and gender of the occupants of each dormitory is shown in the table...
The president of State University wants to forecast student enrollment for this academic year based on...
The president of State University wants to forecast student enrollment for this academic year based on the following historical data: Year Enrollments 5 years ago 15,000 4 years ago 16,000 3 years ago 18,000 2 years ago 20,000 Last year 21,000 What is the forecast for this year using exponential smoothing with alpha = 0.5, if the forecast for two years ago was 16,000?
Increasing Student Enrollment Proposal Case The chancellor of a local private university is looking for ways...
Increasing Student Enrollment Proposal Case The chancellor of a local private university is looking for ways to increase enrollment at his University and circulated a request for a proposal to that effect. In response, the vice president of admissions submitted the following summary proposal. She wishes to enter into a memorandum of understanding with four Universities in the United Kingdom as part of an exchange program. She promises that their earned credits from their Universities will count towards graduation at...
The dean of Mihaylo Business School is forecasting total student enrollment for next year based on...
The dean of Mihaylo Business School is forecasting total student enrollment for next year based on the following historical data: Year Total Enrollment 2015 1600 2016 2000 2017 2200 2018 2600 2019 3000 What is 2020's forecast using a 2-period moving average? Select one: a. 2,800 b. None of the choices c. 3,000 d. 1,960 e. 2,450 What is the MAPE value based on 2 year moving average? Select one: a. None of the choice b. 0.191 c. 0.178 d....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT