Missing queryHash / planCacheKey on count() queries

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.1.0-rc0
    • Affects Version/s: 8.1.0-rc0, 5.0.29, 7.0.16, 6.0.20, 8.0.5
    • Component/s: None
    • None
    • Query Optimization
    • Fully Compatible
    • ALL
    • v8.0, v7.0, v6.0, v5.0
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Dear support,

      I ran recently into a problem using an exporter for DB profiler, and noticed that there is no queryHash / planCacheKey produced for count() queries, forcing the exporter to miss such queries in its report. This behaviour can presumably exist for other type of aggregates as well. MongoDB Server version is 7.0.14 

      An example of such a query plan : 

      [
        {
          "op": "command",
          "ns": "airbnb.listings",
          "command": {
            "count": "listings",
            "query": {
              "bedrooms": { "$gte": 3 },
              "price": { "$lte": "$60" }
            },
            "lsid": {
              "id": "UUID('519636d3-e433-40ae-a2eb-bb917d4fc305')"
            },
            "$clusterTime": {
              "clusterTime": "Timestamp({ t: 1727332097, i: 1 })",
              "signature": {
                "hash": "Binary.createFromBase64('AAAAAAAAAAAAAAAAAAAAAAAAAAA=', 0)",
                "keyId": 0
              }
            },
            "$db": "airbnb"
          },
          "keysExamined": 0,
          "docsExamined": 66334,
          "numYield": 76,
          "locks": {
            "FeatureCompatibilityVersion": {
              "acquireCount": { "r": "Long('78')" }
            },
            "Global": {
              "acquireCount": { "r": "Long('78')" }
            }
          },
          "flowControl": {},
          "readConcern": {
            "level": "local",
            "provenance": "implicitDefault"
          },
          "storage": {
            "data": {
              "bytesRead": "Long('252990177')",
              "timeReadingMicros": "Long('392769')"
            }
          },
          "responseLength": 170,
          "protocol": "op_msg",
          "cpuNanos": 774204048,
          "millis": 1049,
          "planSummary": "COLLSCAN",
          "planningTimeMicros": 128,
          "execStats": {
            "stage": "COUNT",
            "nReturned": 0,
            "executionTimeMillisEstimate": 846,
            "works": 66335,
            "advanced": 0,
            "needTime": 66334,
            "needYield": 0,
            "saveState": 76,
            "restoreState": 76,
            "isEOF": 1,
            "nCounted": 3439,
            "nSkipped": 0,
            "inputStage": {
              "stage": "COLLSCAN",
              "filter": {
                "$and": [
                  { "price": { "$lte": "$60" } },
                  { "bedrooms": { "$gte": 3 } }
                ]
              },
              "nReturned": 3439,
              "executionTimeMillisEstimate": 836,
              "works": 66335,
              "advanced": 3439,
              "needTime": 62895,
              "needYield": 0,
              "saveState": 76,
              "restoreState": 76,
              "isEOF": 1,
              "direction": "forward",
              "docsExamined": 66334
            }
          },
          "ts": "ISODate('2024-09-26T06:28:39.348Z')",
          "client": "192.1.1.181",
          "appName": "mongosh 2.3.1",
          "allUsers": [
            {
              "user": "mongodb-profiler-exporter",
              "db": "admin"
            }
          ],
          "user": "mongodb-profiler-exporter@admin"
        }
      ]

       

      Reference of the issue can be found here : https://github.com/andrii29/mongodb-profiler-exporter/issues/13  

      Is this an expected behaviour ?

      Thanks,

            Assignee:
            Ben Shteinfeld
            Reporter:
            Tac N/A
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: