Push down stages maximally across $unionWith branches

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Currently we only push down $match & $project stages across $unionWith branches. However, any stage that operates on a single document at a time can safely be pushed down. For example:

      {$unionWith: {coll: ..., pipeline: [...]}}, {$lookup: {...}}, {$unwind: ...}

      Is equivalent to:

      {$lookup: {...}}, {$unwind: ...}, {$unionWith: {coll: ..., pipeline: [{$lookup: {...}}, {$unwind: ...}]}}

      This is useful, because the first version was not eligible for SBE pushdown, but the second version is.

              Assignee:
              Unassigned
              Reporter:
              Alya Berciu
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: