Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-12597

Docs for SERVER-24860: Optimize away entire pipeline if it can be answered using a query

      Description

      Description:

      This following topic needs an update: https://docs.mongodb.com/master/reference/explain-results/

      The queryPlanner output may include a new field 'optimizedPipeline: true' to indicate that this plan represents an aggregation request where the pipeline has been optimized away and the request is answered using the query engine only. Note that this is either 'optimizedPipeline: true' or no field at all. That is, 'optimizedPipeline: false' can never appear in the output. Here is an example:

      "queryPlanner" : {
      "plannerVersion" : <int>,
      "namespace" : <string>,
      "indexFilterSet" : <boolean>,
      "parsedQuery" :

      Unknown macro: { ... }

      ,
      "queryHash" : <hexadecimal string>,
      "planCacheKey" : <hexadecimal string>,
      "optimizedPipeline" : true,

      Engineering Ticket Description:

      An aggregation pipeline can be used to represent a query, like the following:

      db.example.aggregate([{$project: {excluded: 0}}, {$match: {predicate: true}}]);
      

      In these cases, it would be more efficient to skip the aggregation layer, and execute the entire computation using a query.

      It is expected that pipelines like the above pipeline will be much more common once non-materialized views are introduced in SERVER-142.

      Scope of changes

      Impact to Other Docs

      MVP (Work and Date)

      Resources (Scope or Design Docs, Invision, etc.)

            Assignee:
            kay.kim@mongodb.com Kay Kim (Inactive)
            Reporter:
            kay.kim@mongodb.com Kay Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              4 years, 37 weeks, 2 days ago