Part 18 of 39
The Hard Question
By Madhav Kaushish · Ages 10+
Glagalbagal's cave was now organised. Primary shelves by location, secondary shelves by purpose, reference tablets for cross-category access. Finding a specific record by location and date was fast. But a new kind of question exposed the limits of this system.
The Advisor's Visit
The chieftain's advisor — a diplodocus named Stravjek, whose neck was long enough to peer at all of Glagalbagal's shelves simultaneously, though this did not help her read them — arrived with a question from the chieftain himself.
Stravjek: The chieftain wishes to know which of your locations had the highest growth during the rainy season over the past three years. He is considering expanding your land grant and wants to allocate additional territory to the most productive site.
Glagalbagal knew the answer was in his records. He had monthly counts for every location going back years. The growth during any period could be computed by comparing the start and end counts. But answering the question required pulling out every record from every location, identifying which months fell during the rainy season, computing growth for each rainy-season period, and comparing across locations and years.
The Slow Search
He assigned three velociraptors to the task. Each velociraptor took one primary shelf (one location), walked along the shelf to find rainy-season records (which meant examining the date label on every record to determine whether it fell in the rainy months), pulled those records, computed growth using the subtraction tablet, and reported the results.
For Locations 1, 2, and 3, the process took about half a day each. The Thjervak Plains shelf, which was much longer, took a full day. In total, answering one question took two and a half days of velociraptor labour.
Stravjek was not pleased with the wait. Neither was the chieftain. Neither, for that matter, was Glagalbagal — he could see that this kind of question would come up again, and spending two days on each answer was not sustainable.
The Problem
The records were organised by location and date. This made it fast to find "Location 2's count from last Smujka" — go to Shelf 2, count to the right position. But it made it slow to find "all records from the rainy season" because rainy-season records were scattered across every shelf, interspersed with non-rainy records. The only way to find them was to examine every record and check whether its date fell in the rainy season.
This was like searching for a specific word in a book by reading every page. If the book had a table at the back listing which pages contained each word, you could go directly to the right pages. Glagalbagal needed the equivalent for his records.
The Index Tablets
Glagalbagal carved a set of stone tablets that he placed at the entrance to the cave. Each tablet organised records by a different criterion:
The Season Index: For each season (rainy, dry, cold, harvest), a list of positions — "Shelf 1 positions 3, 7, 11, 15; Shelf 2 positions 3, 7, 11, 15; Shelf 3 positions..." — pointing to every record from that season.
The Growth Index: Records sorted by growth amount, from highest to lowest, each entry listing which shelf and position contained the full record.

With the Season Index, answering Stravjek's question no longer required examining every record. A velociraptor looked up "rainy season" in the index, obtained a list of positions, went directly to those positions, and pulled only the relevant records. The two-and-a-half-day search became a half-day task.
With the Growth Index, answering "which location had the highest growth in any period" was even faster — just read the top entries.
The Stale Index
The system worked well for three months. Then a velociraptor at the Thjervak Plains discovered a counting error in one of the monthly records and corrected it. The original record had shown a growth of twelve animals. The corrected record showed fifteen.
Blortz, reviewing the Growth Index for an unrelated query, noticed that the Thjervak entry still showed twelve. The velociraptor had updated the actual record on the shelf but had not updated the Growth Index tablet at the cave entrance.
This meant the Growth Index was wrong. Anyone looking up "records with growth above fourteen" would not find this entry — even though the actual record now qualified. The index and the data had drifted apart.
Blortz: The index said one thing. The record said another. Which one is true?
Glagalbagal: The record, obviously. The index is just a shortcut to the record.
Blortz: Then every time a record changes, the index must also change. And we have four index tablets. If a velociraptor forgets to update even one of them after a correction, the index becomes unreliable.
This was the problem of consistency. The indexes were not separate sources of truth — they were derived from the actual records. But they had to be actively maintained, and any gap between a record changing and its indexes being updated created a window in which the indexes lied.
The Rule
Glagalbagal added a line to every instruction tablet that involved modifying a record:
After updating any record, follow the Index Update Tablet before marking the task as complete.
The Index Update Tablet was a subroutine (he was getting good at those) that took the modified record's position, looked up every index that might reference it, and updated the relevant entries. It was tedious and added time to every correction. But it ensured that the indexes and the data stayed synchronised.
The alternative — tolerating occasional staleness — was tempting but, as the Thjervak miscount showed, dangerous. An index that was right most of the time was, in some ways, worse than no index at all, because it inspired false confidence.