SSTable (Sorted String Table) 00:00:01 Seal a sorted fruit catalog A grocer writes apple, banana and cherry into a new file whose keys are already in order. Once published, this sorted string table is immutable. Updates will land in a newer structure. The memtable hands over its entries in key order. The file is empty. apple and banana fill block 0. The index remembers apple at position 0. Both are small and are written after the data. It says where the index and the filter are. Now the file is sealed. The footer identifies the metadata the reader needs to locate data blocks. The ordered contents also make it possible to stream a range or merge tables without random writes into the old file. 00:00:45 Is the requested key in this file? A lookup for one fruit should rarely read the entire table. Start with a membership hint, then use the sparse index to select the block that could contain the key. All bits for date are set: maybe. cherry is the last first key that is not larger than date. That is block 1. Block 1 is read from disk and searched. date is 4. For mango one bit in the filter is 0. The file is skipped. A block lookup is still necessary for a possible match. Finding a nearby index separator alone never proves that the requested key has a stored value. 00:01:24 A fruit the filter has never seen Add a few keys to a tiny Bloom filter so their bit positions visibly overlap. Some new keys can find all their positions already set even though nobody inserted them. All 16 bits are 0. The hashes give 2, 7 and 14. Its first bit is 3, and bit 3 is 0. Another key gives 5, 7 and 14. All are set, by two other keys. A false positive costs an extra file lookup. A valid negative can skip this table. Keep the immutable file and its filter version together so the reader applies the right hint. 00:02:03 Two catalogs both contain the same fruit A newer table now also has a value for one key in the older table. Scan their ordered runs together and resolve overlaps using the version and deletion semantics of the storage engine. Compare the first keys: a and b. a is smaller. It comes from the older file. The newer value 4 is written, and the older 3 is dropped. The rest follows in order. Publication of the merged file must be atomic with the manifest change. Keep old files available while existing readers still hold their references. 00:02:38 Walk from banana to the end of the range A customer asks for a range of fruits rather than one point lookup. Seek once using the index, then move through adjacent ordered entries until the upper bound stops the scan. apple is the last first key that is not larger than banana: block 0. apple is too small. banana is the first result. cherry and date are in the range. The blocks lie next to each other. elderberry reaches the end of the range. That contrast explains the file layout: point reads use hints to avoid work, range reads exploit ordering, and writes create new sorted files that can be merged later.