Statistics

Total Writes: 0
Total Reads: 0
Compactions: 0
Memtable Size: 0
WAL Entries: 0

How LSM Works

1. WAL Write to disk first (durability)

2. Memtable Insert in memory

3. Flush when memtable is full

4. Compact when level has too many files

5. Reads check memtable → L0 → L1 → L2

Use "Generate Bulk Data" to see compactions!

Level Differences

L0: Overlapping keys, newest data

L1: Non-overlapping, sorted ranges

L2: Larger files, oldest data

Size: Each level ~10x larger

Reads: L0 checks all files, L1+ binary search

Operation Log

Write-Ahead Log (WAL) - Disk

Memtable (In-Memory)

Level 0 SSTables (Overlapping Keys)

0 files
Direct flush from memtable • Keys can overlap between files • Must check all files during reads

Level 1 SSTables (Non-overlapping)

0 files
Sorted key ranges • No overlap between files • Binary search for reads • ~10x larger than L0

Level 2 SSTables (Largest Files)

0 files
Largest capacity • Oldest data • Most efficient storage • ~10x larger than L1