mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-07 03:22:46 -05:00
### Does this PR have any customer impact? Yes ### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) Feature ### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes) No ### Are you introducing any new config? If yes, do you have tests with and without them being set? Yes ### ChangeLog (Refer [Template](../oss/CHANGELOG.md)) ### Description When scanning disjoint sets of the tree e.g. on a composite index of (a, b, c) a query of a = 1 && c > 3 && c < 5 we have to scan for every value of B. In this case, we don't skip intermediate parts of hte tree that don't match. This adds support for ascending scans to skip portions of the tree that don't match. Since we don't know what next value is available, uses a new extensibility support function in the index to ask the operator class what the next should be. Additionally adds an option in comparePartial to return "-2" or "-3" which means doesn't match, but also has the potential to skip parts of the tree. This is fully backwards compatible with older RUM installs since the code just checks for < 0 vs > 0 for skipping vs termination. Use that to skip entries within the page when we know that the entry is not a match but something at a later point of the tree may be a match for the query.