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

How to get the detail slow query statement from profiler

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Critical - P2 Critical - P2
    • None
    • None
    • None
    • None

    Description

      As we know, Mongodb Profiler can monitor collection slow queries and save them into db.system.profile collection. Also we can query this collection to get slow query, but I found the INSERT query in Profiler collection isn't saved very clear like

      db.users.insert({ user_id: "bcd001", age: 45, status: "A" })

      statement.

      {
          "op" : "insert",
          "ns" : "",
          "ninserted" : 1,
          "keyUpdates" : 0,
          "numYield" : 0,
          "lockStats" : {
              "timeLockedMicros" : {
                  "r" : NumberLong(0),
                  "w" : NumberLong(29607820)
              },
              "timeAcquiringMicros" : {
                  "r" : NumberLong(0),
                  "w" : NumberLong(18)
              }
          },
          "millis" : 14804,
          "ts" : ISODate("2014-05-05T07:11:19.097Z"),
          "client" : "",
          "allUsers" : [ 
              {
                  "user" : "",
                  "userSource" : ""
              }
          ],
          "user" : ""
      }

      And the QUERY query is changed to a JSON format data, not the raw statment.

      {
          "op" : "query",
          "ns" : "",
          "query" : {
              "expireAfterSeconds" : {
                  "$exists" : true
              }
          },
          "ntoreturn" : 0,
          "ntoskip" : 0,
          "nscanned" : 20,
          "keyUpdates" : 0,
          "numYield" : 0,
          "lockStats" : {
              "timeLockedMicros" : {
                  "r" : NumberLong(153343),
                  "w" : NumberLong(0)
              },
              "timeAcquiringMicros" : {
                  "r" : NumberLong(1),
                  "w" : NumberLong(5)
              }
          },
          "nreturned" : 0,
          "responseLength" : 20,
          "millis" : 153,
          "ts" : ISODate("2014-07-12T22:09:00.696Z"),
          "client" : "",
          "allUsers" : [],
          "user" : ""
      }

      So, how to get the detail slow query raw statement. Any ideas is appreciated. Thanks.

      Attachments

        Activity

          People

            Unassigned Unassigned
            popgo Jianfeng Xu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: