-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Labels:None
Description
This ticket adds fields to explain for the following three query parameters: internalQueryMaxScansToExplode (maxScansToExplodeReached), internalQueryEnumerationMaxOrSolutions (maxIndexedOrSolutionsReached), and internalQueryMaxIntersectPerAnd (maxIndexedAndSolutionsReached). When the planner hits the limits set with these knobs, the value in explain will be set to "true" and a message will be logged at log level 1. If the user does not change the values of these knobs, they will still be set if the planner hits the default limits.
Description of Linked Ticket
There are a handful of parameters that influence the plan generation process. Two examples would be internalQueryEnumerationMaxOrSolutions and internalQueryMaxScansToExplode. When encountered, these modify the set of plans that are available for selection and can have an important impact on the overall efficiency of the query (eg SERVER-36393).
In some situations, it is relatively easy to determine that such a threshold was encountered during planning with a high degree of confidence. For example if the query shape is a (singled) contained $or and there are precisely ten plans that contain a "OR" stage then it is very likely that the deployment is using the default value of 10 for the internalQueryEnumerationMaxOrSolutions parameter and that the threshold was encountered during the planning process. However it very quickly becomes difficult or impossible to definitively determine that these various thresholds were reached in an arbitrary situation.
We should report when the planner encounters these situations in explain output. It is also worth considering adding this to the log output as well (verbose or otherwise).
Scope of changes
- https://docs.mongodb.com/manual/reference/explain-results/index.html
- Be sure to document output for both sharded and unsharded collections.
- https://docs.mongodb.com/manual/reference/method/db.collection.explain/index.html
- https://docs.mongodb.com/manual/reference/method/cursor.explain/index.html
- https://docs.mongodb.com/manual/reference/operator/meta/explain/index.html
- https://docs.mongodb.com/manual/reference/command/explain/index.html
Impact to Other Docs
MVP (Work and Date)
Resources (Scope or Design Docs, Invision, etc.)
- documents
-
SERVER-48625 Explain (and logs) should indicate when query planning thresholds are encountered
- Closed