-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: Q4-24FY
-
Component/s: None
-
2 - S (<= 1 week)
-
6933
-
Not Needed
The code around management of sort/distinct/limit should be refactored to allow for easily adding new stages as well as for planning and optimizing the process from a high level view. We could introduce a pipeline planner that has the ability to make optimizations such as: if we know we are doing a sort followed by a limit, we can restrict the sorting stage to only store and sort the N limited items instead of sorting all items in the results.
Making time for this project would be a great first step before doing Group By. It would also make it easier for new features such as https://github.com/realm/realm-core/pull/6759