CS FundamentalsModerateGATE CS · Product placement
A query optimizer rewrites σ_{city='Pune'}(Customer ⋈ Orders) as σ_{city='Pune'}(Customer) ⋈ Orders, where city is an attribute of Customer only. Why is this rewrite valid and usually beneficial?
- A. Selection commutes with join when it uses only one input's attributes, and filtering early shrinks the join input
- B. It is valid only for outer joins
- C. It changes the result but is faster
- D. It is valid only if city is a key
Correct answer: A. Selection commutes with join when it uses only one input's attributes, and filtering early shrinks the join input
Pushing a selection below a join is an equivalence whenever the predicate mentions attributes of one operand only; it reduces the number of tuples the join must process.
More DBMS and SQL questions
- Which change is an example of PHYSICAL data independence in the three-schema architecture?
- Teach(course, teacher, book) satisfies course ↠ teacher | book, and the course DBMS has 3 teachers and 4 books. How many tuples must Teach…
- For the schedule R1(B), R1(C), W3(A), W1(C), R2(A), W2(C), R3(B), how many distinct serial schedules are conflict-equivalent to it?
- For the schedule R1(B), W3(A), W1(B), W2(B), R2(A), W3(C), R3(C), R2(C), how many distinct serial schedules are conflict-equivalent to it?
- R(A, B, C, D, E, F) has functional dependencies F → E, E → BC, CE → F, C → F. Which of the following is the complete set of candidate keys…
- R(A, B) = {(2, 1), (2, 2), (3, 3), (3, 4)} and S(B, C) = {(1, 5), (2, 5), (3, 5), (3, 6), (3, 7)}. How many tuples does σ{R.B ≠ S.B}(R ×…