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.
Benchmark without index; 1M rows; 4 sort fields; page 80K; article 800K:
Benchmark with index, 1M rows; 4 sort fields; page 80K; article 800K:
Benchmark without index; 5M rows; 4 sort fields; page 400K; article 4M:
Benchmark with index; 5M rows; 4 sort fields; page 400K; article 4M:
It seems the seek method does not use the index, the query may be just too complex 😕 . It doesn't seem to be a way to query with
row values
, so I cannot make it more efficient. Even with just 2 fields the index is not use in my benchmark, at least.Update:
Oh, I found my answer here:
So, my benchmark is an edge case, possibly. The first filtered value is the same for all rows, so the index is not used. When testing two fields I filtered by a duplicated date, and when testing 4 fields I filtered by a boolean. Albeit, a boolean as first field seems common.
Benchmark with index, 1M rows; 1 sort fields; page 80K; article 800K:
Indeed, when testing a single field (ex a unique field), the index is used, and the query is fast. So, the answer is maybe somehow implement the
row values
query if I want this to be fast for more cases.