in Databases retagged by
4,424 views
41 votes

Let r and s be two relations over the relation schemes R and S respectively, and let A be an attribute in R.  The relational algebra expression $\sigma_{A=a}(r \bowtie s)$ is always equal to

  1. $\sigma_{A=a}(r)$
  2. $r$
  3. $\sigma_{A=a}(r) \bowtie s$
  4. None of the above
in Databases retagged by
4.4k views

4 Comments

here selection is based on constant value ,so its better to filter r first

,if selection is based on compaison of attributes it is better to first cartesian then apply condition
0
why this question tagged as difficult?
2
A and B will be false when S is empty.
0
what is ‘a’ in above question?
0

Subscribe to GO Classes for GATE CSE 2022

3 Answers

35 votes
 
Best answer

Answer is C.

C is just the better form of query, more execution friendly because requires less memory while joining. query, given in question takes more time and memory while joining.

edited by

6 Comments

thanks to early use of selection
17
If we consider answer C means, tables will be joined using column 'A'.There may be other similar columns in two tables.Suppose column 'B' is in both.

PLZ explain.
2
According to the equation in the question, we take a join of r and s and then select the rows where attribute A has the value a. In option C, we first apply the filter, i.e. select those rows from r where A attribute has value a and then apply join with s. Hence, C is optimised as the number of rows used in the join is less.
4
@sumaiya mam very nice
0
Wrong explanation given
0
This is what is known as QUery optimisation,

you can also draw optimisation tree for this

NPTEL question on query optimisation

TAG: query optimisation
0
16 votes

 option c

3 Comments

what is "relation schemes R and S respectively" in this question??
0
why you have taken B attribute in relation r and how come B & C attribute
0
What if B dont have entry

20,Y?
0
8 votes
Answer is (C).

It is an efficient way to write the query to select first the tuples then cross with other relation.
Answer:

Related questions