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

No "executionStats" with explain mode for aggregate

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 4.0.1
    • Aggregation Framework
    • None
    • ALL

    Description

      As describe here https://jira.mongodb.org/browse/SERVER-19758, the functionnality  "executionStats" with explain has been added since Mongo version 3.5.5.

      With Mongo version 4.0.1, "executionStats" is not returned with explain mode.

       db.version();
       db.c.drop();
       for (let i = 0; i < 10; i++) { db.c.insert({_id: i, a: 1, b: i}); }
        
       db.c.createIndex({a: 1});
       db.c.createIndex({b: 1});
       
       /* method 1 */ 
       db.c.explain("executionStats").aggregate([{$match: {a: 1, b: {$gt: 3}}}]);
       
       /* method 2 */ 
       db.c.aggregate(
        [{$match: {a: 1, b: {$gt: 3}}}],
        { explain: true }
      )
      

      Result method 1 :
       

      {
          "stages" : [ 
              {
                  "$cursor" : {
                      "query" : {
                          "a" : 1.0,
                          "b" : {
                              "$gt" : 3.0
                          }
                      },
                      "queryPlanner" : {
                          "plannerVersion" : 1,
                          "namespace" : "test.c",
                          "indexFilterSet" : false,
                          "parsedQuery" : {
                              "$and" : [ 
                                  {
                                      "a" : {
                                          "$eq" : 1.0
                                      }
                                  }, 
                                  {
                                      "b" : {
                                          "$gt" : 3.0
                                      }
                                  }
                              ]
                          },
                          "winningPlan" : {
                              "stage" : "CACHED_PLAN",
                              "inputStage" : {
                                  "stage" : "FETCH",
                                  "filter" : {
                                      "a" : {
                                          "$eq" : 1.0
                                      }
                                  },
                                  "inputStage" : {
                                      "stage" : "IXSCAN",
                                      "keyPattern" : {
                                          "b" : 1.0
                                      },
                                      "indexName" : "b_1",
                                      "isMultiKey" : false,
                                      "multiKeyPaths" : {
                                          "b" : []
                                      },
                                      "isUnique" : false,
                                      "isSparse" : false,
                                      "isPartial" : false,
                                      "indexVersion" : 1,
                                      "direction" : "forward",
                                      "indexBounds" : {
                                          "b" : [ 
                                              "(3.0, inf.0]"
                                          ]
                                      }
                                  }
                              }
                          },
                          "rejectedPlans" : []
                      }
                  }
              }
          ],
          "ok" : 1.0
      }
      

      Attachments

        Activity

          People

            nick.brewer Nick Brewer
            dorothee dorothee
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: