Database Systems · Linear Hashing: Overflow Variant, Later-Round Splits and Search Cost
Worked example A: overflow-triggered insertion sequence
Take , (two records per block), , . Insert in order:
All of these are multiples of 4, so for every key. Overflow chains hold records per overflow block and are written ->.
Initial state: buckets 0–3 empty; , .
Insert 12, 20. Both go to bucket 0 (room): B0: 12,20.
Insert 4. → bucket 0, which is full → 4 goes to its overflow chain; then split bucket with : , , . All three have , so all move to the new bucket 4. Now , .
B0: -- B1: -- B2: -- B3: --
B4: 12,20 -> 4
Insert 8. → bucket already split → → bucket 0 (empty): B0: 8.
Insert 28. → → bucket 4, which is full → chain; then split bucket (empty, nothing moves); new bucket 5. , .
B4: 12,20 -> 4,28
Insert 36. → → bucket 4 → new overflow block; split bucket (empty); new bucket 6. , .
B4: 12,20 -> 4,28 -> 36
Insert 44. → → bucket 4 (second overflow block gets 44); split bucket (empty); new bucket 7. → round ends: , , .
B4: 12,20 -> 4,28 -> 36,44
Insert 52. Now : → bucket 4, full → third overflow block; split bucket with : bucket 0 holds , and → moves to the new bucket 8. , .
Final state (, , ):
B0: -- B1: -- B2: -- B3: --
B4: 12,20 -> 4,28 -> 36,44 -> 52
B5: -- B6: -- B7: -- B8: 8
Lesson from example A. Bucket 4 overflowed repeatedly but was never the bucket at the split pointer, so its chain grew to 3 overflow blocks while the pointer walked over empty buckets. This is the characteristic weakness of the overflow-triggered variant. Search for 52 costs bucket accesses.