We only choose a SORT_MERGE stage to combine or-clauses if there is a sort requested and all children can provide the sort. However, we could use a SORT_MERGE stage if all children provide the same sort, even if it is not the sort requested, or there is no sort requested. We look for a sort shared by all children here.
This suggested improvement is assuming that a SORT_MERGE stage is always better than an OR stage in terms of performance or memory usage.
- duplicates
-
SERVER-24518 MERGE_SORT_STAGE can be used more aggressively when OR_STAGE index sort orders match
- Backlog