× Heads up!

Aqua Data Studio / nhilam

Follow
IDE for Relational Databases
×
NielsGron reported 2013-04-24T21:07:54Z  · SachinPrakash last modified 2013-04-24T21:31:59Z

Need a command to enable Profiler : ALTER DATABASE PROFILINGLEVEL X SLOWMS 100


Priority Low
Complexity Unknown
Component MongoSQL
Version Future - .9

I can currently query the profiling system table with : select * from "system.profile"

But I can't change the Profiling level. Would be nice to be able to change it with a command like :

ALTER DATABASE PROFILINGLEVEL X SLOWMS 100

Profiler

MongoDB comes with a very useful profiler. You can tune the profiler to only profile queries that take at least a certain amount of time depending on your needs. I like to have it recording all queries that take over 100ms.

// Will profile all queries that take 100 ms
db.setProfilingLevel(1, 100);

// Will profile all queries
db.setProfilingLevel(2);

// Will disable the profiler
db.setProfilingLevel(0);

The profiler saves all the profile data into the capped collection system.profile. This is just like any other collection so you can run some queries on it, for example

// Find the most recent profile entries
db.system.profile.find().sort({$natural:-1});
    
// Find all queries that took more than 5ms
db.system.profile.find( { millis : { $gt : 5 } } );
    
// Find only the slowest queries
db.system.profile.find().sort({millis:-1});

You can also run the show profile helper to show some of the recent profiler output.

The profiler itself does add some overhead to each query, but in my opinion it is essential. Without it you are blind. I’d much rather add small overhead to the overall speed of the database to give me visibility of which queries are causing problems. Without it you may just be blissfully unaware of how slow your queries actually are for a set of your users.

Issue #8741

Closed
 
 
Completion
No due date
No fixed build
No time estimate

About AquaClusters Privacy Policy Support Version - 19.0.2-4 AquaFold, Inc Copyright © 2007-2017