I enabled profiling in a mongodb database since sometimes a query is fast while sometimes the exact same query takes a very long time, despite the execution plan being a IXSCAN. I suspect it is due to locking issues but in the database profiler output acquireWaitCount, timeAcquiringMicros and deadlockCount are missing. How can I find these values and how can I find the query that holds those locks? I am using mongodb 4.2
Here is the output from a database profiler query:
{
"op": "query",
"ns": "db.Caratula-221",
"command": {
"find": "Caratula-221",
"filter": {
"EmpresaId": "33707830439",
"Carpeta": "VALOR CRITERIO"
},
"limit": 1,
"readConcern": {
"level": "linearizable"
},
"$db": "db",
"lsid": {
"id": "a4c0937f-a77c-40c4-ae4a-f14fc8c67042"
},
"$clusterTime": {
"clusterTime": "Timestamp(1598361984, 1)",
"signature": {
"hash": "BinData(0,\"AAAAAAAAAAAAAAAAAAAAAAAAAAA=\")",
"keyId": 0
}
}
},
"keysExamined": 1,
"docsExamined": 1,
"cursorExhausted": true,
"numYield": 0,
"nreturned": 1,
"queryHash": "D282DB09",
"planCacheKey": "8921BB9F",
"locks": {
"ParallelBatchWriterMode": {
"acquireCount": {
"r": 2
}
},
"ReplicationStateTransition": {
"acquireCount": {
"w": 3
}
},
"Global": {
"acquireCount": {
"r": 2,
"w": 1
}
},
"Database": {
"acquireCount": {
"r": 1,
"w": 1
}
},
"Collection": {
"acquireCount": {
"r": 1
}
},
"Mutex": {
"acquireCount": {
"r": 1
}
},
"oplog": {
"acquireCount": {
"w": 1
}
}
},
"flowControl": {
"acquireCount": 1
},
"storage": {},
"responseLength": 2492,
"protocol": "op_msg",
"millis": 8383,
"planSummary": "IXSCAN { EmpresaId: 1, Carpeta: 1 }",
"ts": "2020-08-25T13:26:32.526Z",
"client": "192.168.2.78",
"allUsers": [
{
"user": "dbadmin",
"db": "admin"
}
],
"user": "dbadmin@admin"
}