Systems on Glass ยท Episode 5 ยท System design

Indexes

or: how to find one thing in ten billion

About eight minutes, in four parts: how an index works, the index zoo, the catch, and one read by key (with an illustration of indexing a whole cloud). Generated by Claude as part of my AI-automation side project. The narration is an AI clone of my own voice.

Made with AI, for fun

Systems on Glass is an AI-automation side project of mine. Every episode is generated by Claude (Anthropic's AI, working through Claude Code in my own video studio): the script, the animations and 3D scenes, the edit, and the narration in an AI clone of my voice. I choose the topics, bring the stories from my own work, and review each episode before it goes up. Not affiliated with Anthropic.

At Amazon Ads, the API I worked on answered over a million calls a second, each inside 20 ms, and not one of them searched for anything. Each went straight to its answer, by key. The opposite, reading ten billion rows one by one for a single question, would take nearly three hours at a million rows a second.

The short version

As in my post about this API, every number about that system is illustrative, and the design there is simplified. The ten-billion-row table, the scan times and the 500-keys-per-page tree are illustrative arithmetic too.

10,000,000,000 rows รท 1,000,000 rows/s = 10,000 s โ‰ˆ 2.8 h (full scan, illustrative)
logโ‚‚(10 billion) โ‰ˆ 33.2 โ†’ 34 steps ยท 500โด = 62.5 billion โ†’ ~4 page reads
1 insert + 5 indexes = 6 writes ยท Bloom filter: ~9.6 bits a key for 1% false positives

And my job today. I now work on Azure Resource Graph, which handles 12B+ Azure resources a day. The episode uses it only as an illustration, built from Microsoft's public docs, not as a description of its internal design: when a resource changes, Azure Resource Manager notifies Resource Graph, which "then updates its database", and "a regular full scan" catches anything missed. You query that copy in KQL (Resources | summarize count()), never the resources themselves. The docs name the price too: the data "isn't strongly consistent" and is "indexed with a short latency".

DynamoDB's docs say it plainly: the partition key's value goes into an internal hash function, and the output decides the partition the item lives in. That's a hash index spread across a fleet, which is why the same viral key always lands on the same partition, and why AWS asks you to design for uniform activity across all your partition keys.

Further reading

Next episode: Prompt like a spec, and why rules beat clever wording. Previously: Context Is RAM. All episodes โ†’