The Gateway to Computer Science Excellence
+13 votes
4.1k views

Given a block can hold either 3 records or 10 key pointers. A database contains n records, then how many blocks do we need to hold the data file and the dense index

  1. 13n/30
  2. n/3
  3. n/10
  4. n/30
in Databases by Active (2.5k points) | 4.1k views
0
please post the question

3 Answers

+18 votes
Best answer
total number of block required by data file = n/3

total number of records needed by pointer = n/10. ( key pointer = no of keys)

total blocks = n/3+n/10 =13n / 30
by Boss (16.1k points)
+2
for sparse index wt will be ans.??
+13
then it will be 11n/30 because the number of pointer will be n/3/10 = n/30 blocks will be required for index file. while for record file it will be n/30+n/3= 11n/30
0
if we find no of levels then ?
+10 votes

This is a question on simple indexing and so we should not bother about higher level of indexing..

So no of records given  =  n

 no of records per data block given = 3

So no of data blocks    =  n / 3

Now we know in dense index ,

No of <key,pointer> pairs in dense index = No of data records 

So

No of <key,pointer> pairs in 1st level index here = n

So no of  index blocks  = n/10 [ As there are 10 such pairs per index block]

So total no of data blocks and index blocks required  =  n / 3 + n / 10

                                                                             =  13 n / 30

Hence A) should be the correct answer..

by Loyal (9.9k points)
0
how many levels ?
0
no level is here
0

Given a block can hold either 3 records or 10 key pointers.

10 key pointers means ==> 10 ( key+block pointer ) 

right ??

+2 votes

For $n$ records, blocks required = $\frac{n}{3}$

For $n$ indices in the index file, blocks required = $\frac{n}{10}$

Total = $\frac{n}{3}+\frac{n}{10}$ = $\frac{10n}{30}+\frac{3n}{30}$ = $\frac{13n}{30}$

Option A


Bonus:-

In case of sparse indexing:

For $n$ records, blocks required = $\frac{n}{3}$

For $\frac{n}{3}$ indices in the index file, blockes required = $\frac{n}{30}$

Total = $\frac{n}{3}+\frac{n}{30}$ = $\frac{10n}{30}+\frac{n}{30}$ = $\frac{11n}{30}$


For dense indexing, we have a pointer (index in the index file) for each record.

For sparse indexing, we have a pointer for each block. (More specifically for every first record of the block)

by Loyal (6.6k points)
Answer:

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,324 answers
198,405 comments
105,169 users