Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started