Suppose we have a Relation of 5,000 Data Records/tuples. Each Page/block can hol
ID: 3850684 • Letter: S
Question
Suppose we have a Relation of 5,000 Data Records/tuples. Each Page/block can hold 5 Data Records/tuples, or 10 key-pointer pairs (Data Entries k*). The Indexes built on the key field of the Relation (thus no duplicate search keys) and the file is sorted according to the key. Answer the questions below about the space required for each Index (Just the Index, not the Data as well). a. How many Pages do we need for a dense Index of this Relation? Answer: b. How many Pages/blocks do we need for a sparse Index of this Relation? ANSWER:Explanation / Answer
a)For dense index ,for every record we have to create index.We have total of 5000 records.Total we have 5000 indexes.Each block/page can hold 10 key pointer-pairs(indexes).So 5000/10 is equal to 500.We need total of 500 blocks for dense indexing.
b)For sparse indexing, index is created for some of the records only.We have total of 5000 records.Each block can hold only 5 records.So we need total 5000/5 =1000 blocks for holding records.In sparse indexing we will only store the addresses of the starting indexes of every block.So Total we have 1000 blocks ,so we need to create 1000 indexes.To Hold 1000 indexes we need 1000/10 = 100 blocks or pages ,because each page can hold 10 key-pointer pairs(indexes).