Awesome q2a theme
0 votes

Assume that a data file contains 2000 records that are ordered by a key attribute K , and a primary index on attribute K is built.

The size of key is 5B and block pointer is 5B. Each block of the system is of size 105B, out of which 100B can be used to store data (and 5B is reserved for storing meta data).

The total number of disk accesses required to fetch the record using the index (in average case) is  _____.



Here answer should be 4

initial number of blocks in database file = 100,

So $1^{st}$ level of index file contains 100 records which will be divided into 10 blocks

Now $2^{nd}$ level of index file contains 10 records which will be divided into 1 block

Last level will contain only 1 record

So total number of access = 1(access for record in database file) + 3(accesses in indexes)

in Databases by (356 points) | 95 views
U mean $\log10$ not required?
Yes, it should not be used. But if it has been used than we get 3.219 when $log_210$ is considered

so the answer has been considered as $\textbf{\{ceil(3.219) + 1\} ={4+1 = 5}}$
but whatever u r telling, is it for multilevel indexing or primary indexing?
primary indexing, but there can be multiple levels of indexes just like a normal b-tree


Such indexing not exists. Actually whatever u r doing is multilevel index using primary indexing. See this u could understand Same thing with secondary indexing.

Here question asking "for total number of disk accesses". right?? not number of blocks in 1st or 2nd level. ok??

1 Answer

+2 votes
Best answer
Number of record in data file $=2000$

Block size $105B$

Blocking factor$=\left \lfloor \frac{105}{10} \right \rfloor=10$

Number of blocks in 1st level index$=\left \lceil \frac{2000}{10} \right \rceil=200$

Number of blocks in 2nd level index$=\left \lceil \frac{200}{10} \right \rceil=20$

Number of blocks in 3rd level index$=\left \lceil \frac{20}{10} \right \rceil=2$

Number of blocks in 4th level index$=\left \lceil \frac{2}{10} \right \rceil=1$

So, total block access=index block access+data block access=$=4+1=5$

Hope ur doubt clear now
by (817 points)
selected by
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
Top Users 2020 Aug 10 - 16
  1. jayeshasawa001

    11 Points

  2. Arkaprava

    6 Points

  3. 404 found

    3 Points

  4. shashankrustagi2021

    2 Points

  5. Mellophi

    2 Points

  6. siddharths067

    1 Points

  7. sparshgarg

    1 Points

  8. sonam13

    1 Points

Weekly Top User (excluding moderators) will get free access to GATE Overflow Test Series for GATE 2021
Welcome to GATE CSE Doubts, where you can ask questions and receive answers from other members of the community.
Top Users Aug 2020
  1. Mellophi

    152 Points

  2. Ashutosh777

    76 Points

  3. anurag sharma

    48 Points

  4. jayeshasawa001

    16 Points

  5. Kushagra गुप्ता

    15 Points

  6. Shaik Masthan

    13 Points

  7. srestha

    13 Points

  8. shashankrustagi2021

    12 Points

  9. munishchaturvedi

    10 Points

  10. arjun12

    10 Points

7,743 questions
1,841 answers
95,103 users