Mango `$lt` and `$gt` operators are backed by inclusive key ranges
- Dominant language
- Erlang
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 9
Description
Mango index scans do not handle the `$lt` ("less than") and `$gt` ("greater than") operators efficiently. In case of `$lt`, `inclusive_end=true` is always assumed, so e.g. if there was a selector equivalent to `age < 20`, the key scanned would include `20` and those documents would need filtering out in memory. Similarly, for `$gt`, the start key is always inclusive, which cannot even be changed, i.e. there is no `inclusive_start` option. This can cause a bigger impact on the performance of in-memory filtering if the count is high for the documents with the start and end keys.
Investigate the possibilities for making the interval scan exclusive to cut down on the size of the set of elements forwarded for filtering.
Contributor guide
Research direction
Start with Mango index scan handling for the $lt and $gt operators, tracing how inclusive_end and the start key define the interval. Compare those bounds with the selector semantics and assess how exclusive boundaries could reduce documents forwarded for in-memory filtering; done means boundary documents are no longer scanned unnecessarily without changing query results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- erlang
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100