google / google/leveldb

Iterator::Prev very slow

Open
#1,048 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
39.4k
Forks
8.2k
PR merge metrics
No merged PRs in 30d

Description

It took more than more than 360s to traverse 15GB (7342 files) data in reverse with `Prev`.

This is my logic:
```cpp
open db;
seek to a key;
NewIterator();
Prev(); // this call is very very slow.
```

I traced the problem with `strace`. Then I found that 'pread64' was executing most of time, about 320s. I also found more than 100 SSTable files were read.

I was confused why so many SSTable files were read. I guess that is the cause. So I got SSTable info with 'GetProperty(leveldb.sstables)' and try to find why so many files were read.
According to the code, I found at most 17 files were read which is much smaller than it actually was.

My version is 1.18-5.

Who has the same problem as me? Any suggestions are welcome.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.