Q. explain() executionStats mode

I check the manual because I got curious while conducting the explain(“executionStats”) test.
But I have a question because there is a slightly ambiguous sentence for me to understand.

executionStats Mode

MongoDB runs the query optimizer to choose the winning plan, executes the winning plan to completion, and returns statistics describing the execution of the winning plan.

Does this sentence mean that you actually run the query (not sample) using the winning plan selected by the optimizer and show the statistics of the results?

If I’m running a real query, then .explain(“executionStats”) will use the same amount of resources as when I run the query.

Yes, it actually runs the query and will show the statistics of the query execution, apart from the results.

explain() has overhead.

1 Like

Hi, @Jack_Woehr :smiley:
Thank you very much for your reply.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.