Question
Consider a database implemented using B+ tree for file indexing and installed on a disk drive with block size of 4 KB. The size of search key is 12 bytes and the size of tree/disk pointer is 8 bytes. Assume that the database has one million records. Also assume that no node of the B+ tree and no records are present initially in main memory. Consider that each record fits into one disk block. The minimum number of disk accesses required to retrieve any record in the database is _______.
Official answer and solution
- Official answer
- 4
- From
- Official GATE 2020 answer key
Solution
Compute the fanout capacity of B+ tree nodes and determine tree height plus data block access.
Parameters:
- Block size
- Search key size
- Pointer size
- Number of records
Capacities of B+ tree nodes:
- Internal node: holds pointers and keys:
- Leaf node: holds key-pointer pairs and 1 block pointer to the next leaf:
Minimum height of B+ tree to index records:
- To minimize height (and disk accesses), consider maximum fanout:
- Level 1 (Root): 1 node, up to 205 pointers.
- Level 2 (Internal): up to 205 nodes, up to pointers.
- Level 3 (Leaf nodes): 42,025 leaf nodes can hold up to records, easily accommodating records.
- Thus, the minimum tree height is 3 levels.
Total disk accesses:
- 1 access for root node (Level 1)
- 1 access for internal node (Level 2)
- 1 access for leaf node (Level 3)
- 1 access for the data block containing the actual record
- Total minimum disk accesses = .
4
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2020 Computer Science and Information Technology (CS)
- Question
- 64 of 65, printed as CS Q.54
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.