Docs Menu
Docs Home
MongoDB Cloud Manager
/ / /

Configure the Slow Query Threshold

The Performance Advisor recognizes a query as slow if it takes longer to execute than the value of slowms. By default, this value is 100 milliseconds. You can change the threshold with either the profile command or the db.setProfilingLevel() mongosh method.


The following profile command example sets the threshold at 200 milliseconds:

profile: 0,
slowms: 200

If you are running MongoDB 3.6 or later, you can customize the percentage of slow queries in your logs used by the Performance Advisor by specifying the sampleRate parameter.


This sets the slow query threshold to a lower value of 100 milliseconds but also sets the sample rate to 10%.

profile: 0,
slowms: 100,
sampleRate: 0.1


By default, the value of profile is 0. MongoDB recommends leaving this value unchanged since other values can negatively impact database performance. To learn more, see the profile command.


Monitor and Improve Slow Queries


Review Index Ranking