Question: SQL SQL management 2009-2014 The following query is executing very slowly on a large amount of data. Would an Index help to speed it up?

SQL

SQL management 2009-2014

The following query is executing very slowly on a large amount of data.

Would an Index help to speed it up? If so, which columns should be indexed? Explain why an index can help but doesn't always.

SELECT c.cinema_name, s.price*SUM(t.ticket_id) AS 'total' FROM Cinema c INNER JOIN MovieSession s ON c.cinema_id = s.cinema_id INNER JOIN Ticket t ON t.ticket_id = s.ticket_id GROUP BY s.price, c.cinema_name HAVING SUM(t.ticket_id) > 5

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!