in Databases
8,090 views
6 votes
6 votes
Consider the following statement
(i) Primary index is always sparse
(ii) Secondary index may or may not be dense
Which of the above statement is/are false?

A)Only (i)

B)Only (ii)

C)Both (i) and (ii)

D)None of these

in Databases
8.1k views

1 comment

correct answer is A.

Primary index can be dense or can be sparse. But sparse is preferable on primary index. so option A is false. Secondary index is always dense over key but it can be dense or sparse over non key.

chosen answer is wrong!
0
0

3 Answers

10 votes
10 votes
Best answer
Ans is D

Primary is always sparse. Secondary may be dense if done on a key field and sparse if done on a non-key field.
selected by

4 Comments

edited by
what if block size equals to record size, then each block will hold 1 record then in this case for every record we should have an entry in an index file which will satisfy the meaning of dense index then how can we say primary indices are always sparse??
0
0

Sparse Index : A sparse index in databases is a file with pairs of keys and pointers for every block in the data file.

Dense Index: A dense index in databases is a file with pairs of keys and pointers for every record in the data file.

if block size equals to record size then also it will be sparse index only(according to above defination)

Ref: https://en.wikipedia.org/wiki/Database_index

0
0

@minal

Korth says:

"A file may have several indices, on different search keys. If the
file containing the records is sequentially ordered, a clustering index is an index whose search key also defines the sequential order of the file. Clustering indices are also called primary indices; the term primary index may appear to denote an index on a primary key, but such indices can in fact be built on any search key. The search key of a clustering index is often the primary key, although that is not necessarily so."

Further it says:

"In a dense index, an index entry appears for every search-key
value in the file. In a dense clustering index, the index record contains the search-key value and a pointer to the first data record with that search-key value. The rest of the recordswith the same search-key valuewould be stored sequentially after the first record, since, because the index is a clustering one, records are sorted on the same search key."

So what you want to conclude from this and what Elamasri Navathe says?

0
0
1 vote
1 vote
i think option C is correct.

primary index may or may not be sparse.

but Secondary index is always dense.

1 comment

you answer is correct idk why it is voted as wrong one
0
0
0 votes
0 votes
D

Secondary  index cant be sparse they have to be dense coz values are scattered among the db file and file is not ordered on search key and primary index can be dense/sparse.
edited by

2 Comments

check this out... answer should be D only..
http://nptel.ac.in/courses/106106093/13
1
1
Yes i wrote wrong option acc to  explanation d is correct
1
1

Related questions