Practice free →
HomeGATE CSEcomputerscienceDatabase Management Systems › If only one tuple in $S$ has $b\_id=102$ out of …

If only one tuple in $S$ has $b\_id=102$ out of a billion total, then between $\sigma_{b\_id=102}(R \bowtie S)$ and $R \bowtie \sigma_{b\_id=102}(S)$, the truth is

Adifferent answers; only the first is correct
Bsame answer, identical performance
Csame answer, second is far faster (filter-then-join shrinks the join input)
Ddifferent answers; the second drops rows that match the filter
Answer & Solution
Correct answer: C. same answer, second is far faster (filter-then-join shrinks the join input)
Both forms are logically equivalent (commutativity of σ with ⋈ when σ touches only one relation). The cost differs hugely: filter-then-join joins a billion rows down to one row first, then does a tiny join. Join-then-filter joins a billion against the other side before filtering. Same answer, very different cost.
Solve this in the app — GATE CSE practice & 24k+ MCQs →
Related questions