(#3211) - remove unused metadata.seq index (idb) #3211
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So this is a bit of a hard choice, because if we ever want to bring this index back, it will have to be in a migration.
Besides the perf numbers below (which are good), my reasoning is thus:
I already tested using the
metadata.seq
forchanges()
, under the hypothesis that it would be better to only iterate winning seqs. In fact the perf was actually worse fortemp-views
, presumably because the cost of using the secondary index outweighed the benefit of increasing the read perf, which makes sense, since in those tests, all the docs are generation-1 and so there are noseq
s to be skipped.So there is an argument to be made that for databases with lots of revisions to a small number of documents, it would be faster to iterate over
metadata.seq
thanseq
. However, since most databases only need to usechanges()
for replication, which uses checkpoints, meaning it only has to iterate once, I think this is fine.Plus, writes are slower than reads in LevelDB under the hood, and writes are what we want to really optimize for. Our read performance seems good, in general.
Anyway, perf numbers for this commit are below. Note that I bumped up the number of iterations for the
insert
tests in order to get more granularity: