Navigation

Performance Advisor

The Performance Advisor monitors queries that MongoDB considers slow and suggests new indexes to improve query performance. The Performance Advisor recognizes a query as slow if it takes longer than 100 milliseconds to execute. For the selected host and time period, the Performance Advisor evaluates up to the 20,000 most recent slow queries found in the logs.

Recommended indexes are accompanied by sample queries, grouped by query shape, that were run against a collection that would benefit from the suggested index. The Performance Advisor is always enabled and does not negatively affect the performance of your Atlas clusters.

Note

To view field values in a sample query in the Performance Advisor, you must be a user with at least one of the following access:

Users without the aforementioned access cannot see the field values.

Considerations

Indexes improve read performance, but a large number of indexes can negatively impact write performance since indexes must be updated during writes. It is important to consider this tradeoff when deciding whether to create new indexes for a collection that already has several. Examine whether a query for such a collection can be modified to take advantage of existing indexes, as well as whether a query occurs often enough to justify the cost of a new index.

Limitation

The Performance Advisor cannot suggest indexes for MongoDB databases configured to use the ctime timestamp format. As a workaround, set the timestamp format for such databases to either iso8601-utc or iso8601-local.

Understanding the Query Inefficiency Score

The Performance Advisor displays sample queries with recommended indexes. Each sample query includes a query inefficiency score, which is how many documents were read for every document returned by the query. A score of 1 represents a very efficient query because every document read matched the query and was returned with the query results. The Performance Advisor displays a warning icon next to any score over 1,000, which represent highly inefficient queries. All suggested indexes represent an opportunity to improve query performance.

Enable or Disable Performance Advisor for a Project

Required Privileges

To enable or disable Performance Advisor for a project, you must have the Project Owner role for the project.

Performance Advisor is enabled by default. To disable or enable Performance Advisor:

1

Click Settings.

2

Toggle the button next to Performance Advisor.

Access Performance Advisor

To access the Performance Advisor:

1

Click Clusters.

2

Click the replica set where the collection resides.

If the replica set resides in a sharded cluster, first click the sharded cluster containing the replica set.

3

Click Performance Advisor.

4

Select a collection from TOP COLLECTIONS.

5

Select the time period from the list box for which you want to view data.

The Performance Advisor displays up to 20 query shapes across all collections in the cluster and suggested indexes for those shapes.

Note

The Performance Advisor collects existing indexes for collections with slow queries every 12 hours. However, the Performance Advisor generates indexes based on actual queries within five minutes of query execution. It is possible to see suggestions for indexes that you have already created, but these are removed the next time that the Performance Advisor collects indexes.