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 have the Group Owner role. Users without this role cannot see 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.

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.

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 24 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.