Hi Monika,
I would recommend reading the code path for the explain command
<https://docs.mongodb.com/manual/reference/command/explain/>. Explain calls
into the Command::explain() virtual method, implemented by CRUD commands
such as find and aggregate. The entry point for explain of a find command,
for example, is here:
https://github.com/mongodb/mongo/blob/edc3dfce51b00ba3007f35cf6383efb72bf8b74e/src/mongo/db/commands/find_cmd.cpp#L139
For the aggregate command, the entry point is here:
https://github.com/mongodb/mongo/blob/edc3dfce51b00ba3007f35cf6383efb72bf8b74e/src/mongo/db/commands/pipeline_command.cpp#L99
You may also wish to read some of the explain-specific logic which lives in
explain.{h,cpp}:
https://github.com/mongodb/mongo/blob/edc3dfce51b00ba3007f35cf6383efb72bf8b74e/src/mongo/db/query/explain.h
Explain currently exposes query-level execution statistics, not
storage-level statistics. Collecting some of the metrics you mentioned may
require some deeper collaboration with the storage layer. However, I hope
that the pointers I've listed above are a good starting point.
Best,
Dave
Post by Monika ShahI appreciate your prompt reply.
I would like to find time, space, data proximity, power for different
components(like per tuple cost, per memory page cost, per IO channel cost)
used by each query plan.
Post by 'David Storch' via mongodb-devHi Monika,
There are quite a few submodules involved in query processing: the query
planner, the query execution engine (composed of the query exec library and
the aggregation framework libraries), the full text search engine,
geospatial search, the mongos query execution path, and so on. In order for
me to help you find a starting point for reading the source code, could you
give me a little bit more detail about what submodule you are interested or
about the performance metrics you are hoping to add?
Best,
Dave
Post by Monika ShahThank you David.
I wanted to ask you that how can I trace source code for query processing.
I want to know how can I contribute for performance metrics. So, I want
to understand path and apply change for testing my idea
Post by 'David Storch' via mongodb-devHi Monika,
I'm not sure exactly what you mean by tracing query processing, but you
could try enabling verbose logging for the QUERY log component. This will
log lots of detail from the query planner in particular. You can enable
this by connecting to the server with the mongo shell and running the
db.setLogLevel(5, "query");
If you provide some more detail about what you were trying to do, I
might be able to be more helpful!
Best,
Dave
Post by Monika ShahHow can we trace query processing as well as query optimization?
--
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-dev+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-dev/fdff8992-baad-4cba-9fd7-7e329d98c526%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.