GATE / CS ARCHIVE

SIMILAR QUESTIONS / DATABASE MANAGEMENT SYSTEMS

Fit keys and child pointers in an internal node

3 questions solved the same way, newest first. Back to Database Management Systems

How these are solved

Solve p·pointer_size+(p−1)·key_size≤block_size; distinguish pointer fanout p from key capacity p−1 and leaf record pointers.

2 marks · NAT
Report issue

Indexing, Storage & Query Processing

Question 39, GATE 2015: A B+ tree has search keys of 12 bytes, blocks of 1024 bytes, record pointers of 10 bytes, and block pointers of 8 bytes. What is the maximum number of keys that fit in each non-leaf node? Use the usual internal-node layout with one more child pointer than keys and no additional stated overhead.
Tap to enlarge
Answer & solution

Official answer: 50

1. For k=50 the node uses 50·12+51·8=1008 bytes, which fits. For k=51 it needs 51·12+52·8=1028 bytes, exceeding the block. These adjacent checks establish the maximum, not just a rounded estimate.

2. An internal node with k keys has k+1 child pointers, so 12k+8(k+1)≤1024. Thus20k≤1016 and k≤50. Record pointers belong in leaves and are not counted here.

Original paper, page 66 · Answer key

2 marks · MCQ
Report issue

B-plus tree internal-node order

Indexing, Storage & Query Processing

Question 52, GATE 2004: The order of an internal B+ tree node is its maximum number of children. Child pointers use 6 bytes, search keys 14 bytes and each node occupies a 512-byte block. With no stated header overhead, what is the order?
Options:
(A) 24
(B) 25
(C) 26
(D) 27
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. With order p, an internal node holds p child pointers and p−1 separator keys. The size is 6p+14(p−1)=20p−14≤512, so p≤26.3 and the maximum integer is 26.

2. At p=26 the node uses 506 bytes; p=27 would need 526 bytes. No unmentioned header overhead is assumed.

3. Teaching check: There is one fewer separator key than child pointers, so a p-child node needs p pointers and p−1 keys. Using p of each would incorrectly lower the capacity. Testing the two neighboring integers confirms maximality rather than relying only on rounded division.

Original paper, page 7

2 marks · MCQ
Report issue

Maximum fanout of a B-plus-tree node

Indexing, Storage & Query Processing

Question 2.23, GATE 2002: Build a B⁺-tree index on STUDENT.Name. Each name occupies 8 bytes, a disk block holds 512 bytes, and an index pointer occupies 4 bytes. What is the best degree, defined as pointers per node?
(A) 16; (B) 42; (C) 43; (D) 44.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

Step 1: Check the limiting integers explicitly.

Step 2: For43 pointers there are 42 keys, using 43×4+42×8=172+336=508 bytes, which fits 512. For44 pointers and 43 keys, storage is 176+344=520 bytes, which does not fit. Thus43 is the maximum under the stated layout;42 is unnecessarily conservative, and 16 leaves substantial unused space.

Conclusion: An internal node with m child pointers has m−1 separator keys. Its storage is 4m+8(m−1)=12m−8 bytes. Requiring this to fit 512 bytes gives m≤43⅓, so the largest integer fanout is 43, C. This uses the stated idealized node layout without extra header bytes;44 would need 520 bytes.

Original paper, page 6