dongfangho 发表于 2018-10-25 09:08:35

mongodb 3.0+ 查询性能分析

{  
    "queryPlanner" : {
  
      "plannerVersion" : 1,
  
      "namespace" : "personmap.person",
  
      "indexFilterSet" : false,
  
      "parsedQuery" : {
  
            "age" : {
  
                "$lte" : 2000.0
  
            }
  
      },
  
      "winningPlan" : {
  
            "stage" : "FETCH",
  
            "inputStage" : {
  
                "stage" : "IXSCAN",
  
                "keyPattern" : {
  
                  "age" : 1.0
  
                },
  
                "indexName" : "age_1",
  
                "isMultiKey" : false,
  
                "direction" : "forward",
  
                "indexBounds" : {
  
                  "age" : [
  
                        "[-1.#INF, 2000.0]"
  
                  ]
  
                }
  
            }
  
      },
  
      "rejectedPlans" : []
  
    },
  
    "executionStats" : {
  
      "executionSuccess" : true,
  
      "nReturned" : 2001,
  
      "executionTimeMillis" : 143,
  
      "totalKeysExamined" : 2001,
  
      "totalDocsExamined" : 2001,
  
      "executionStages" : {
  
            "stage" : "FETCH",
  
            "nReturned" : 2001,
  
            "executionTimeMillisEstimate" : 0,
  
            "works" : 2002,
  
            "advanced" : 2001,
  
            "needTime" : 0,
  
            "needFetch" : 0,
  
            "saveState" : 16,
  
            "restoreState" : 16,
  
            "isEOF" : 1,
  
            "invalidates" : 0,
  
            "docsExamined" : 2001,
  
            "alreadyHasObj" : 0,
  
            "inputStage" : {
  
                "stage" : "IXSCAN",
  
                "nReturned" : 2001,
  
                "executionTimeMillisEstimate" : 0,
  
                "works" : 2002,
  
                "advanced" : 2001,
  
                "needTime" : 0,
  
                "needFetch" : 0,
  
                "saveState" : 16,
  
                "restoreState" : 16,
  
                "isEOF" : 1,
  
                "invalidates" : 0,
  
                "keyPattern" : {
  
                  "age" : 1.0
  
                },
  
                "indexName" : "age_1",
  
                "isMultiKey" : false,
  
                "direction" : "forward",
  
                "indexBounds" : {
  
                  "age" : [
  
                        "[-1.#INF, 2000.0]"
  
                  ]
  
                },
  
                "keysExamined" : 2001,
  
                "dupsTested" : 0,
  
                "dupsDropped" : 0,
  
                "seenInvalidated" : 0,
  
                "matchTested" : 0
  
            }
  
      }
  
    },
  
    "serverInfo" : {
  
      "host" : "qinxiongzhou",
  
      "port" : 27017,
  
      "version" : "3.0.7",
  
      "gitVersion" : "6ce7cbe8c6b899552dadd907604559806aa2e9bd"
  
    },
  
    "ok" : 1.0
  
}
  

  
db.getCollection('person').find({"age":{"$lte":2000}}).explain("executionStats")


页: [1]
查看完整版本: mongodb 3.0+ 查询性能分析