-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Query Execution, Query Planning
-
Fully Compatible
-
v5.2
-
QE 2022-02-07
-
(copied to CRM)
-
150
MongoDB currently uses a runtime plan selection strategy to choose a winning query plan from amongst a set of candidates. This process is called "multi-planning", and it involves partially executing each candidate, and then using the resulting runtime statistics to make a plan choice. The classic execution engine and the SBE execution engine have different implementations of multi-planning. The SBE multi-planner is affected by SERVER-62150, a performance bug which can cause the SBE multi-planner to be much more expensive than the classic multi-planner. This ticket tracks an idea to mitigate SERVER-62150.
The SBE multi-planner inherited some logic from the classic multi-planner where the maximum number of storage reads allowed during the trial period is calculated as either 10,000 or 30% of the collection, whichever is larger. (These constants are configurable as setParameters, but are generally not reconfigured in the field.) This potentially high bound of 30% of the collection size is not overly problematic for the classic multi-planner because of its round-robin behavior – each plan does a small amount of work in a round-robin fashion until a winner is found. This means that with the exception of the scenario described in SERVER-31078, the length of the classic multi-planner trial period should be relatively well bounded.
Not so for the SBE multi-planner. The absence of round-robin plan execution in the SBE multi-planner means that we can easily hit the 30% of the collection size limit even if there is a much better plan available. Therefore, the proposal for this ticket is to introduce a new setParameter which is symmetric with internalQueryPlanEvaluationCollFraction called internalQueryPlanEvaluationCollFractionSbe. The former parameter, internalQueryPlanEvaluationCollFraction, will apply only to the classic multi-planner whereas internalQueryPlanEvaluationCollFractionSbe will apply only to the SBE multi-planner. Importantly, we will choose a default value of 0 for internalQueryPlanEvaluationCollFractionSbe. This means that the length of an individual SBE candidate plan's trial period will be bounded to 10,000 storage cursor reads, which should avoid the worst affects of SERVER-62150.
- is related to
-
SERVER-62150 SBE Multiplanning can be slow when suboptimal plan runs first
- Closed
-
SERVER-31078 Query planning is very slow during multiplanning when result set is empty
- Backlog
- related to
-
SERVER-63102 Make separate internalQueryPlanEvaluationWorks knobs for the classic and SBE multi-planners
- Closed
-
SERVER-63642 Add serverStatus metrics to measure multi-planning performance
- Closed
-
SERVER-63641 Improve SBE multi-planning by choosing which plan to work next based on a priority metric
- Closed