[SERVER-78113] not cache meaningless plan, it will increased memory overhead and increase computing overhead. Created: 15/Jun/23  Updated: 13/Oct/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: y yz Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: pull-request
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File image-2023-06-15-14-51-29-750.png     PNG File image-2023-06-15-14-52-20-383.png    
Assigned Teams:
Query Optimization
Participants:

 Description   

 when the mode is PlanCachingMode::AlwaysCache or PlanCachingMode::SometimesCache, there is a special case.
 take Classic plan cache for example:
   If the winning index's advanced = 0 && works == 1 && isEOF == true, which means we didn't get any data to rank score, all candidates 
   score is same. the score of the calculation is meaningless.

In this case, if we cache the plan, it will increased memory overhead. when the cached plan stage pick best plan, it will trigger replan. this will increase computing overhead.



 Comments   
Comment by y yz [ 13/Oct/23 ]

Do we have the conclusion of this question? If so, we can synchronize it. Thank you.

 

thanks.

Comment by y yz [ 15/Jun/23 ]

the code address:  https://github.com/mongodb/mongo/pull/1555

Comment by y yz [ 15/Jun/23 ]

 

Comment by y yz [ 15/Jun/23 ]

if the winning index's advanced = 0 && works == 1 && isEOF == true, which means we didn't get any data to rank score, all candidates score is same. the score of the calculation is meaningless.

 

In this case, if we cache the plan, it will increased memory overhead. when the cached plan stage pick best plan, it will trigger replan. this will increase computing overhead.

Generated at Thu Feb 08 06:37:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.