[SERVER-64522] POC support for both the classic and SBE plan cache Created: 15/Mar/22  Updated: 27/Oct/23  Resolved: 18/Mar/22

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

Type: Task Priority: Major - P3
Reporter: Eric Cox (Inactive) Assignee: Rui Liu
Resolution: Works as Designed Votes: 0
Labels: sbe
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Sprint: QE 2022-03-21
Participants:

 Description   

We should poc routing cached plans with SBE $group and $lookup to the classic plan cache and other SBE plans in the SBE cache.



 Comments   
Comment by Eric Cox (Inactive) [ 18/Mar/22 ]

rui.liu Thanks for the update and investigation here. This is good news. Closing.

Comment by Rui Liu [ 17/Mar/22 ]

eric.cox This can be closed if we're OK with above.

Comment by Rui Liu [ 17/Mar/22 ]

Some updates on this. In short, we're already using the classic cache on the non-pipeline part of the query.

If the query has pipelines, we will try to retrieve from the classic cache on the non-pipeline part of the query, and later attach the pipeline solutions. We will not cache into the SBE cache in this case, but we may cache the non-pipeline part into the classic cache conditionally, depending on which planner we run.

If the query doesn't have pipelines, we will try to retrieve it from the SBE cache. However, due to SERVER-64315 we will not write to the SBE cache so the reading will be empty.

In terms of when we cache into the classic cache for queries with pipelines, there seem to be four types of planners that all do slightly differently:

1) If the non-pipeline part of the query produces a single solution, we will not cache anything in the classic cache.
2) If the non-pipeline part of the query produces multiple solutions, we will run a multi-planner and cache the winning solution in the classic cache always.
3) If the non-pipeline part of the query can be sub-planned, we will run a sub-planner that uses multi-planners in each branch and cache the winning solution in the classic cache conditionally based on some scoring data. Note that what's in the cache is each query branch, not the entire $or query.
4) If the non-pipeline part of the query hits the cache, we will run a cached solution planner which may replan using a multi-planner and it will cache conditionally depending on whether the original cache fails to execute.

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