Iterator perfomance degradation

Hey @sev3ryn, thank you for investigating the issue. The increase in latency is because the deleted items are not being removed. This might be happening because you have older versions of the same item on higher LSM tree levels (0 is the lowest). The deleted entries are removed only when they’re at the same level as their un-deleted versions.

We stop the compactions while running DB.Flatten. This would also block the memtable flush (if L0 doesn’t have space) and so your writes would also get blocked. @sev3ryn Have you tried running DB.Flatten on an online badger instance?