in Databases
909 views
3 votes
3 votes

a. a dense index on R.B

b. a sparse index on R.B

c. a dense index on S.B

d.  a sparse index on S.B

in Databases
909 views

8 Comments

i am getting option A.

What is the answer they provided?
1
1

@Shaik Masthan

@Somoshree Datta 5

I m not getting the solution....plz elaborate more!

0
0

@himgta

For pinging Somoshree Datta 5, comment on her answer, otherwise she didn't get the notification

0
0

@Shaik Masthan....brother can you post your solution?

0
0
R(A,B,C) contains 5000 tuples, sorted on attribute A.

S(B,D) contains 100000 tuples, sorted on attribute B.

we have to do R join S, but join should be on some condition, otherwise it will simply Cartesian Product.

But by seeing the options, it will indicate that join means natural join.===> Attribute B is compared.

R.B == S.B ? already S is sorted on B ===> Sparse Index on S.B

But R is sorted on A ===> secondary index on R with B as key ===> Dense Index on R.B

(This is a non-standard question, no need to bother if more than one option is correct.)
2
2

@Shaik Masthan brother still not getting it

R.B == S.B ? already S is sorted on B ===> Sparse Index on S.B
 

 

0
0
in natural join, the common attributes are equal.. In this two tables common attribute is B only !

therefore we have to check R.B == S.B

S is sorted on attribute B ===> Sparse index on S.B
0
0
got it...thanks brother!
0
0

2 Answers

2 votes
2 votes

Option (a) A dense index on R.B

Here it is given that R is sorted on attribute A and S is sorted on attribute B. As R is already sorted on attribute A, so it may or may not be sorted with respect to attribute B. Hence secondary indexing(since it may be non-key or candidate key and the file may be unordered w.r.t B) has be present for R where the key field is R.B. As secondary indexing is dense indexing, hence a dense index needs to be formed on the attribute R.B.

4 Comments

how can we decide what will become key in R⋈S? why didn't we do indexing on S.B rather on R.A?
0
0
We dont need to know what will become the key in R$\bowtie$S. Here join attribute is B, so in order to be able to access R.B and S.B, we need a dense index on R.B(since R is unsorted wrt field B) and a sparse index on S.B(since S is already sorted wrt field B).
1
1
check the comments
0
0
Yes both A and D options are correct.
1
1
1 vote
1 vote

Option D should be a correct answer...  
The concept is in the data file attribute on which the entries are in sorted order use each block anchor as index entry...

Not all entries... If you are forced to store all data file entries then DENSE otherwise SPARSE.

Then Ans is Option D.

1 comment

check the comments
0
0