Skip to content

Instantly share code, notes, and snippets.

@khapota
Created August 21, 2017 14:18
Show Gist options
  • Save khapota/a4bef5f2c40d75356c1ccac7a8d6f280 to your computer and use it in GitHub Desktop.
Save khapota/a4bef5f2c40d75356c1ccac7a8d6f280 to your computer and use it in GitHub Desktop.
Kill long query
db.currentOp().inprog.forEach(
function(op) {
if(op.secs_running > 5 && op.op == 'query') printjson(op);
}
)
@khapota
Copy link
Author

khapota commented Aug 22, 2017

// check theo collection op.ns
if(op.secs_running > 10 && op.ns.indexOf('collection_name') !== -1) printjson(op);

@khapota
Copy link
Author

khapota commented Aug 24, 2017

Check op structure in document because it is changed following version of mongodb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment