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

'explain' should include actual resource consumption costs when run with verbosity 'executionStats'

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 6.3.0-rc0
    • None
    • None
    • None
    • Fully Compatible
    • QE 2022-11-14, QE 2022-11-28

    Description

      Original title: 'explain' should include estimated resource consumption costs
      In order to make it easier for MongoDB users to tally resource consumption costs for Serverless, it would be useful for resource consumption to be returned as part of the 'explain' output.

      Example:

      test> db.foo.find({}).explain()
      {
        explainVersion: '1',
        queryPlanner: {
          namespace: 'test.foo',
          indexFilterSet: false,
          parsedQuery: {},
          queryHash: '17830885',
          planCacheKey: '17830885',
          maxIndexedOrSolutionsReached: false,
          maxIndexedAndSolutionsReached: false,
          maxScansToExplodeReached: false,
          winningPlan: { stage: 'COLLSCAN', direction: 'forward' },
          rejectedPlans: []
        },
        command: { find: 'foo', filter: {}, '$db': 'test' },
        operationMetrics: { docBytesRead: 51, docUnitsRead:2 }
      

      Actual implementation:

      When explain is run with verbosity executionStats or higher, the "executionStats" now contain "operationMetrics" as well if profileOperationResourceConsumptionMetrics is enabled. These operationMetrics show runtime stats, if they are not zero. The stats are nested within "operationMetrics" which is nested in "executionStats." They include:

      "cpuNanos"
      "cursorSeeks"
      "docBytesRead"
      "docBytesWritten"
      "docUnitsRead"
      "docUnitsReturned"
      "docUnitsWritten"
      "idxEntryBytesRead"
      "idxEntryBytesWritten"
      "idxEntryUnitsRead"
      "idxEntryUnitsWritten"
      "totalUnitsWritten"
      "keysSorted"
      "sorterSpills"

      Attachments

        Activity

          People

            adi.agrawal@mongodb.com Adi Agrawal
            milkie@mongodb.com Eric Milkie
            Votes:
            0 Vote for this issue
            Watchers:
            15 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: