Hash Indexes & Append-Only Logs
6 min read.
Watch writes append to a log, a hash map point at the newest record, segments compact, and the map rebuild after a crash.
Think of it this way: A hash index is a diary you only ever write at the end of, plus a sticky note on the fridge listing which page holds the latest entry for each topic. Looking something up is one glance at the note and one flip to a page. When the diary gets long, you copy only the latest entry for each topic into a fresh diary and throw the old one away.
No segments yet.
A hash index keeps every key in a map in memory. The map says where the newest value sits in a log on disk.
Check your understanding
Answer from memory before you scroll back up. Pulling an idea out of your head is what makes it stay there.
Follow a write through a hash index
Order what happens from a put to getting the value back and later cleaning up.
Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.
- 1Drop a step here
- 2Drop a step here
- 3Drop a step here
- 4Drop a step here
- 5Drop a step here
Quiz
8 questionsWhere does a new write go in a hash-indexed log store?
Done with this lesson?
Sign in free to keep your progress, streak and quiz scores.