CS FundamentalsModerateGATE CS · Amazon/Microsoft SDE MCQ
A query plan computes σ_{dept = 'D1' ∧ sal > 50}(Emp ⋈ Dept). Which rewrite is a heuristic optimizer most likely to apply first, and why?
- A. Replace the join with a Cartesian product, since products need no index
- B. Push the selections below the join so fewer tuples enter it
- C. Pull projections above the selection so every attribute stays available
- D. Split the conjunction into two separate joins on Emp and on Dept
Correct answer: B. Push the selections below the join so fewer tuples enter it
Selections are pushed as low as possible (here onto Emp, or onto whichever relation owns each attribute) to shrink the join input; this is usually the biggest win. Products are never cheaper than an equivalent join, and projections are pushed down, not up.
More DBMS and SQL questions
- A B+ tree has order p = 4 (at most 4 children per internal node, at most 3 keys per leaf) and every node except the root is at least half…
- A relation R has candidate keys AB and BC, and FDs AB → C, C → A. Which statement explains why R is in 3NF but not BCNF?
- Which relational-algebra equivalence is NOT valid in general?
- R(A, B, C, D, E, F, G) has the functional dependencies AB -> C, C -> D, D -> A, BE -> F, F -> E, CG -> B. How many candidate keys does R…
- R(A, B, C, D, E) has the functional dependencies C → B, A → D, A → C, BE → A. How many superkeys does R have (counting every attribute set…
- R(A, B, C, D, E, F) has the functional dependencies EB → FA, EB → F, AB → C, D → AC, D → A, DF → A. After splitting right sides into…