Optimize pipelines with $sort after $setWindowFields where possible

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 5.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • Query Optimization 2021-04-05, Query Optimization 2021-04-19, Query Optimization 2021-05-03, Query Optimization 2021-05-17
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Semantically, the $setWindowFields stage does not guarantee an output order so users may add a $sort stage to get the order they want. Since the physical implementation for $setWindowFields happens to have a guaranteed order, we should drop (or coalesce or swap) the user $sort if its not necessary.

              Assignee:
              David Percy (Inactive)
              Reporter:
              Nicholas Zolnierz
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: