Discussion:
[mongodb-dev] Query processing code
Monika Shah
2017-09-26 16:37:13 UTC
Permalink
How 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/95a47d7f-0e1d-4a47-8c44-45b18fc8e3b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'David Storch' via mongodb-dev
2017-09-26 17:05:13 UTC
Permalink
Hi 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
following:

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 Shah
How 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/e5fb692e-cf88-46fd-8949-d25a19329430%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Monika Shah
2017-10-02 13:38:07 UTC
Permalink
Thank 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-dev
Hi 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 Shah
How 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/19c84157-fb5b-4eaf-b7a4-5f4eb1070eff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'David Storch' via mongodb-dev
2017-10-03 14:25:29 UTC
Permalink
Hi 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 Shah
Thank 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-dev
Hi 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 Shah
How 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/d12dc95c-4120-4e52-9f44-cad15d9bdcb1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Monika Shah
2017-10-03 15:17:14 UTC
Permalink
I 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-dev
Hi 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 Shah
Thank 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-dev
Hi 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 Shah
How 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/9364d57e-54b8-44e5-83db-1f1c6f4ba27f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'David Storch' via mongodb-dev
2017-10-05 13:56:01 UTC
Permalink
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 Shah
I 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-dev
Hi 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 Shah
Thank 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-dev
Hi 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 Shah
How 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.
Monika Shah
2018-02-05 11:51:25 UTC
Permalink
Link you shared is good to have some basic idea.
Can you share me code of query optimization?
Post by 'David Storch' via mongodb-dev
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
https://github.com/mongodb/mongo/blob/edc3dfce51b00ba3007f35cf6383efb72bf8b74e/src/mongo/db/commands/find_cmd.cpp#L139
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
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 Shah
I 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-dev
Hi 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 Shah
Thank 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-dev
Hi 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
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 Shah
How 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/ea4c1599-fa5c-4598-8a99-f4aea7856bc8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Monika Shah
2018-04-01 08:49:50 UTC
Permalink
I have set break point find_cmd.cpp:132 (first line of
find_cmd.cpp::explain() ), and find_cmd.cpp:231.
After that when I debug code, it stop at this line only for
db.collection.findOne() not for db.collection.find( predicate1,
predicate2).count().


Please help me to see how does it verify criteria to prepare plan



















0
Post by 'David Storch' via mongodb-dev
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
https://github.com/mongodb/mongo/blob/edc3dfce51b00ba3007f35cf6383efb72bf8b74e/src/mongo/db/commands/find_cmd.cpp#L139
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
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 Shah
I 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-dev
Hi 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 Shah
Thank 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-dev
Hi 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
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 Shah
How 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/99099919-bf9c-4e14-8851-404e1cac7f60%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...