GATE / CS ARCHIVE

GATE CSE 2023 / QUESTION 62

GATE CSE 2023 Q62

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

GATE 2023, Q62 2 marks · NAT
Report issue

Indexing, Storage & Query Processing

Question 62, GATE 2023: An ordered file has 25,000 unspanned records of 100 bytes, including a 15-byte primary key. Blocks hold 1024 bytes. A sparse primary index has one anchor key and 5-byte block pointer per data block, with unspanned entries. Binary search on b index blocks costs ceil(log2 b) accesses by stipulation. How many accesses identify the candidate data block, without reading that block?
Tap to enlarge
Answer & solution

Official answer: 6

Each data block holds floor(1024/100)=10 unspanned records, so 25000 records occupy 2500 blocks. The sparse primary index has one anchor entry per data block. Each entry occupies 15+5=20 bytes, so an index block holds floor(1024/20)=51 entries and the index needs ceil(2500/51)=50 blocks. By the expressly given search-cost rule, identifying the data-block pointer costs ceil(log2 50)=6 block accesses. Reading that data block would add one more, but the question asks only to identify it.

Teaching detail. Unspanned storage requires rounding at each level before progressing. A block cannot store 10.24 records, so 24 bytes remain unused after its ten full records. Similarly an index block stores 51 complete 20-byte entries, leaving four bytes. There are 2500 data-block anchors, not 25,000 record-level entries, because the index is sparse. Since 49·51=2499, a fiftieth index block is necessary for the final anchor. With 32<50≤64, the stated ceiling-logarithm search rule yields six accesses, excluding the data fetch.

Original paper, page 65 · Answer key