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 Databases databases indexing + – Keith Kr asked Oct 19, 2014 Keith Kr 8.0k views answer comment Share Follow See 1 comment See all 1 1 comment reply Sinchit commented Dec 11, 2020 reply Follow Share 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 votes 0 votes Please log in or register to add a comment.
Best answer 10 votes 10 votes 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. Keith Kr answered Oct 19, 2014 selected Nov 24, 2016 by Tendua Keith Kr comment Share Follow See all 10 Comments See all 10 10 Comments reply Anurag_s commented Jan 23, 2015 reply Follow Share Can you tell how secondary index can be sparse 0 votes 0 votes Keith Kr commented Jan 23, 2015 reply Follow Share Slide 15 : https://www.cs.purdue.edu/homes/bb/cs448/lecture-files/pdf/ch14-Indexing%20Structures%20for%20Files.pdf 0 votes 0 votes minal commented Apr 23, 2016 reply Follow Share reference : given in navathe ( ans D is correct ) 10 votes 10 votes Dexter commented Apr 23, 2016 reply Follow Share Sonam is correct . I agree with her :) 1 votes 1 votes reena_kandari commented Jul 11, 2017 reply Follow Share @Bikram sir, @joshi_nitish I think secondary index can not be sparse, because it is unclustered and file records are arbitrary stored in the disk.Even if we index on the basic of candidate key using sparse index can never say where the next record will be stored in the disk. 1 votes 1 votes AnilGoudar commented Jul 11, 2017 reply Follow Share Yes, Secondary index is always dense, as secondary index file contains all the entries(Indexed attribute of each row) of the database. 1 votes 1 votes joshi_nitish commented Jul 11, 2017 reply Follow Share @reena, in secondary indexing there is index for each value of attribute(secondary indexing attribute), therefore secondary indexing is both dense and (not sparse) dense because it has indexing for every unique value and (not sparse) because there is index for every value of that attribute(secondary indexing attribute).. 1 votes 1 votes akash.dinkar12 commented Oct 21, 2018 i edited by akash.dinkar12 Oct 22, 2018 reply Follow Share 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 votes 0 votes Dharmendra Lodhi commented Oct 21, 2018 reply Follow Share 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 votes 0 votes Raj Singh 1 commented Jan 27, 2019 reply Follow Share @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 votes 0 votes Please log in or register to add a comment.
1 votes 1 votes i think option C is correct. primary index may or may not be sparse. but Secondary index is always dense. khushtak answered Jan 25, 2016 khushtak comment Share Follow See 1 comment See all 1 1 comment reply SeekerAI commented Jan 23 reply Follow Share you answer is correct idk why it is voted as wrong one 0 votes 0 votes Please log in or register to add a comment.
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. Anurag_s answered Jan 23, 2015 edited Jan 23, 2015 by Anurag_s Anurag_s comment Share Follow See all 2 Comments See all 2 2 Comments reply Hcas Hgnis commented Jan 23, 2015 reply Follow Share check this out... answer should be D only.. http://nptel.ac.in/courses/106106093/13 1 votes 1 votes Anurag_s commented Jan 23, 2015 reply Follow Share Yes i wrote wrong option acc to explanation d is correct 1 votes 1 votes Please log in or register to add a comment.