in Databases
6,760 views
1 vote
1 vote
consider a file of 8192 records .each records is 16 bytes long and its key field is pf size 6 bytes.the file is ordered on a key field and the file organization is unspanned .the file is stored in a file system with block size 512 bytes . and the size of the block pointer 10 bytes.if the primary index is built on the key field of the file and a multilevel index scheme i used to store the primary index,the number of first level and second level blocks in the multilevel index are respectively_________
in Databases
6.8k views

2 Answers

4 votes
4 votes
Best answer
No of records in one block=512/16=32

No of data blocks=8192/32=256

No of entries in one index block=512/16=32

No of first level index blocks=256/32=8

No of second level index block=1( 8 entries would fit in single block)
selected by

4 Comments

max 32 entries can fit in single block..so 8 entries fit in one block this is what i meant 8 entries would fit in one block
1
1
edited by

@Pooja Let say , in this question if we get

No of block in first level index is 64

then how do we find the block in 2nd level?

then is it, No of block in second level index is 64/32 =2

Am I right?

0
0

I have one question here , 

in lowest level index , do we have entry(6 byte key field + 10 byte Block) for all 8192 records or just for 256 block

above calculation are by considering in lowest level there is entry for just 256 block in lowest level index.

If i consider first case then calculation will looks like

No of blocks Needed to store data =

8192 records * 16 byte (size of each record) / size of block (512) = 256 block

No of blocks needed to store key + index for all 8192 records =

= 8192 * 16 Byte (size of key field + size of index field) / size of block (512) = 256 blocks

Above level become lowest (Third) level index

Number of blocks in second level =

256 (Number of blocks)  *  16 Byte (size of key field + size of index field) / size of block (512) = 8

Number of blocks in first level =

8 (Number of blocks)  *  16 Byte (size of key field + size of index field) / size of block (512) = 1

Please some one verify my answer

0
0
1 vote
1 vote

File has 8192 records

Each record size 16 B

Key field 6 B

Block pointer size 10 B

Block size 512 B

No of record in each block 512/16 = 32

No. of blocks 8192/32 =256

For primary indexing 

key and pointer field size 6+10=16B

So, No. of entry in each block 512 B/16 B= 32

So, no of blocks in first level index 256/32 = 8

Second level entry will be 1 (As 32 entries fit in 1 block)

reshown by

1 comment

I think it will be 256/16 =16 and at the second level 16/16=1.. Because our fan out would be 16 not 32.
1
1