Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SQL optimization, execution trees, relational algebra. Look at the query below that finds the products, stores in Montreal and their managers where products that have

SQL optimization, execution trees, relational algebra.
Look at the query below that finds the products, stores in Montreal and their managers where products that have a buying price of over 500 are sold at a price that is less then 10% higher than the buying price.
SELECT P.pid, S.storeId, S.manager
FROM Products P, Stores S, StorePrices SP
WHERE P.pid = SP.pid
AND S.storeId = SP.storeId
AND P.buyingPrice >500.00
AND SP.sellingPrice P.buyingPrice *1.1
Assume, 1% of all products have a buying price of over 500 and there are around 10% that are sold for less than 10% over the buying price.
A non-optimized relational expression for this query is
\pi pid,storeId,manager(\sigma buyingPrice >Products P500sellingPrice less than buyingPrice1.1((Products\times Stores) StorePrices))
An execution tree after a purely algebraic optimization is attached.
1. For each of the edges in the tree with labels (A)-(F), indicate the number of tuples and the
size of each of these tuples that flow from the child operator to the parent operator. Keep in
mind that SQL, unlike relational algebra, keeps the join attributes from both input relations
in the output.
2. Find an execution tree where the intermediate results have less tuples than in the tree of
Question 1. Calculate the number of tuples and their sizes that flow from one operator to
the next.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions