Question: Heuristic Query Optimization Consider the following relational database schema (primary keys are underlined) and SQL queries: Hotel (hotelNo, hotelName, city) Room (roomNo, hotelNo, type, price)

Heuristic Query Optimization Consider the following relational database schema (primary keys are underlined) and SQL queries: Hotel (hotelNo, hotelName, city) Room (roomNo, hotelNo, type, price) Booking hotelNo, guestNo, dateFrom, date To, roomNo) Guest (guestNo, guestName, guestAddress) 1. SELECT r.room No, r.type, r.price FROM Room r, Booking b, Hotel h WHERE r.roomNo = b.room No AND b.hotelNo = h.hotelNo AND h.hotelName = "Ritz" AND r.price > 100; For this query: (A) state what information they retrieve (B) give a corresponding Relational Algebra expression (C) draw the initial canonical query tree (D) use heuristic optimization to transform it into the most efficient query tree possible. (E) Compare the cost of at least two different query plans for the given queries. You can make appropriate assumptions for the database statistics (F) Suggest what appropriate indexes should be built upon the given relations to improve the query performance. Justify your answer Show all intermediate steps and transformations in detail. You can make appropriate assumptions for the database statistics to support your claim. Heuristic Query Optimization Consider the following relational database schema (primary keys are underlined) and SQL queries: Hotel (hotelNo, hotelName, city) Room (roomNo, hotelNo, type, price) Booking hotelNo, guestNo, dateFrom, date To, roomNo) Guest (guestNo, guestName, guestAddress) 1. SELECT r.room No, r.type, r.price FROM Room r, Booking b, Hotel h WHERE r.roomNo = b.room No AND b.hotelNo = h.hotelNo AND h.hotelName = "Ritz" AND r.price > 100; For this query: (A) state what information they retrieve (B) give a corresponding Relational Algebra expression (C) draw the initial canonical query tree (D) use heuristic optimization to transform it into the most efficient query tree possible. (E) Compare the cost of at least two different query plans for the given queries. You can make appropriate assumptions for the database statistics (F) Suggest what appropriate indexes should be built upon the given relations to improve the query performance. Justify your answer Show all intermediate steps and transformations in detail. You can make appropriate assumptions for the database statistics to support your claim
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
