Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-44258

Pipeline::optimize() does not split a $match with an $or with a single child

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Query Optimization
    • Query 2019-12-16, Query 2019-12-30, Query 2020-01-13
    • 21

      As part of SERVER-36723, a second call to optimizePipeline() was removed as the original intent for doing this was only to absorb a $limit which is no longer necessary. However this introduced a more subtle behavior change, since our pipeline optimization code first attempts to re-order/split stages and then optimizes each individual stage. In the case where a $match has a $or with one child, the second phase will remove the $or altogether. There's a chance that the new $match without the $or can be split and moved ahead of a prior stage, which coincidentally will happen on the second call to optimizePipeline().

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            nicholas.zolnierz@mongodb.com Nicholas Zolnierz
            Votes:
            1 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: