GATE / CS ARCHIVE

GATE CSE 2020 / QUESTION 54

GATE CSE 2020 Q54

Database Management Systems · Indexing, Storage & Query Processing · Full GATE CSE 2020 paper

GATE 2020, Q54 2 marks · NAT
Report issue

Indexing, Storage & Query Processing

Question 54, GATE 2020: A B+ tree indexes one million records on a disk with 4 KB blocks. Search keys are 12 bytes and tree/disk pointers 8 bytes. Initially no index node or record is cached; each record fits in one disk block. Find the minimum disk accesses to retrieve any record in the conventional separate-record layout.
Tap to enlarge
Answer & solution

Official answer: 4

Worked explanation

An internal node with m child pointers has m−1 separating keys. Its bytes are 8m+12(m−1)=20m−12, at most 4096. Thus m≤205.4 and maximum fanout is 205 (206 would require 4108 bytes). A leaf key/record-pointer pair takes 20 bytes, so it holds at most 204 pairs; adding an 8-byte next-leaf pointer still permits 204. Two index levels, root and leaves, hold at most 205×204=41820 entries and cannot cover one million. Three levels have capacity 205²×204=8573100, enough. A lookup must read one node per level, then follow the leaf’s record pointer to a separate data block. Three index reads plus one data read give four. The calculation concerns minimum height, not arbitrarily sparse trees.

Derivation and answer

With4KB=4096 bytes, an internal node with m child pointers and m−1 keys needs 8m+12(m−1)≤4096, giving maximum fanout 205. A leaf holds up to 204 key/record-pointer pairs even with one 8-byte next-leaf pointer. A root plus leaves can address at most 205*204=41820 records, below one million. Three index levels can address 205*205*204=8573100 records, so the minimum tree has three levels. With nothing cached, fetch root, internal node and leaf, then the separate record block: 4 disk accesses. This is the conventional separate-record B+ index layout; the record itself is not stored inline in the leaf.

Original paper, page 16 · Answer key