47 views

In a conference, the relation, $\textsf{registered (participant, topic)}$ stores the names of participants and the topics registered by them. The primary key for this relation is $\textsf{(participant, topic)}.$ The relation, $\textsf{fee (participant, amount)}$ stores the fees paid by participants and the primary key for this relation is $\textsf{participant}.$ There are five categories of participants and fees paid under each category are Rs. $1000,$ Rs. $2000,$ Rs. $3000,$ Rs. $4000,$ and Rs. $5000.$ Assume that each category has equal number of participants.

Now consider the following query:

List all topics registered by participants who have paid more than a given amount $x$. To execute the above query, there may be two strategies as follows.

Strategy I:

create table r1 as select * from fee where amount >x;
select distinct topic
from registered as R, r1 as T
where R. participant = T participant;

Strategy II:

select distinct topic
from registered as R, fee as T
where R. participant = T. participant and amount >x;

Assume that there are no null values in the tables.

1. Which strategy is faster for $x=3000?$ Justify your answer.