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

Improve dependency handoff between agg and query

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Execution
    • 35

      In SERVER-66061 we realized that we are doing some crazy stuff where a $group pipeline may generate a dependency set, pass that as a projection into the query layer, and then have the query layer optimize out that projection if/when a $group is pushed into the query layer. This seems sad and inefficient, so we have the following ideas to explore:
      1) Instead of passing dependencies in as a projection, the aggregation system could pass in a new parameter which is the dependencies itself. This would communicate more clearly the intention, and make it possible to only add the projection if we don't swallow the $group.
      2) Improve the interface for pushing down the $group so that we can know and decide to push a $project and/or a $group around the same time. Right now the $group is sometimes added in a callback function after we have entered the planner's getExecutorFind(). This makes it sketchy to modify the projection. This could maybe take the form of just always passing a $group into the query system, and letting it decide whether to use SBE to do the $group or to add some shim around DocumentSourceGroup or somehow indicate it was not possible. This may be crazy with library cycles.

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: