[SERVER-38021] 【query plans issue】inappropriate candidate plans are generated Created: 08/Nov/18 Updated: 08/Nov/18 Resolved: 08/Nov/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 3.6.8 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | zhang mengzhi | Assignee: | Danny Hatcher (Inactive) |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||
| Operating System: | ALL | ||||||||||||||
| Steps To Reproduce: | 1、create index:
2、aggregate explain:
when I add more elements to $or, the number of candidate plans is growing too, and it takes more time to evaluate them. |
||||||||||||||
| Participants: | |||||||||||||||
| Description |
|
when we update our mongodb from 3.4 to 3.6, some query plans take much more time than 3.4. some aggregation took 10 seconds in 3.6 while 100ms in 3.4. explain(): "rejectedPlans" is empty in 3.4, but it contains one element in 3.6. I found the variable "_candidates" in "multi_plan.cpp" are inappropriate. In this case, it may take much more time to evaluate these candidate plans. |
| Comments |
| Comment by Danny Hatcher (Inactive) [ 08/Nov/18 ] | ||||||||||||||||||||||
|
Hello Zhang Mengzhi, As Charlie pointed out, you have encountered an optimization introduced by In the meantime, there are several options available to you.
Because any changes to the code will originate in SERVER-36393, I will close this ticket as a duplicate. Thank you, Danny | ||||||||||||||||||||||
| Comment by zhang mengzhi [ 08/Nov/18 ] | ||||||||||||||||||||||
|
for version 3.6, this expression will generate up to 64 (internalQueryPlannerMaxIndexedSolutions) candidate plans, but for version 3.4, it just generate 1 candidate plan.
| ||||||||||||||||||||||
| Comment by Charlie Swanson [ 08/Nov/18 ] | ||||||||||||||||||||||
|
Upon first glance, this seems like a similar issue to SERVER-36393. | ||||||||||||||||||||||
| Comment by zhang mengzhi [ 08/Nov/18 ] | ||||||||||||||||||||||
|
It Seems to be related to "index_tag.cpp" |