[SERVER-14542] How to get the detail slow query statement from profiler Created: 13/Jul/14  Updated: 10/Dec/14  Resolved: 14/Jul/14

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Critical - P2
Reporter: Jianfeng Xu Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 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.



 Comments   
Comment by Ramon Fernandez Marina [ 14/Jul/14 ]

Thanks for your report. The SERVER project is for reporting bugs or feature suggestions for the MongoDB server and tools. For MongoDB-related support discussion please post on the mongodb-users group or Stack Overflow with the mongodb tag. A question like this involving more discussion would be best posted on the mongodb-users group.

Generated at Thu Feb 08 03:35:11 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.