Docs Home / Compass / Interact with Your Data / Query

View Query Performance

To help you better understand the performance of your query, you can view your query's explain plan.

About This Task

On the Explain Plan modal, you can view the explain stages as a Visual Tree, where each query operation appears as a node on the tree. You can also view the explain details in raw JSON format by selecting the Raw Output view.

Note

The Explain Plan doesn't show aggregation pipeline stages such as $merge and $out because Compass ignores all out stages from the aggregation before running the explain plan.

To learn more about your query through AI-powered guidance, use the MongoDB assistant.

The explain plan includes a Query Performance Summary with information on the execution of your query such as:

  • Execution time
  • The number of returned documents
  • The number of examined documents
  • The number of examined index keys

Note

You cannot view vector search queries in Visual Tree format.

Steps

1

Click Explain

In the query bar, click the Explain button to open the modal.

Query plan
2

Select a query operation

By default, the explain stages are are shown as a Visual Tree. Each query operation appears as a node on the tree.

For more detailed execution information about the query operation, click the corresponding node.

For example, the following explain plan provides detailed information on a query that filters for { title : "Jurassic Park" }:

Detailed Visual Tree view
3

(Optional) Select the Raw Output view.

To view your full explain plan as raw JSON, select the Raw Output view.

Learn More