[SERVER-66946] Cache SBE plans for queries that specify a hint Created: 01/Jun/22  Updated: 23/Feb/23  Resolved: 16/Feb/23

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

Type: Improvement Priority: Major - P3
Reporter: David Storch Assignee: Backlog - Query Optimization
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-72803 Cache hinted SBE queries Closed
Assigned Teams:
Query Optimization
Participants:

 Description   

james.wahlin@mongodb.com brought up a good point: the SBE plan cache aims to prevent the cost of query recompilation even for queries that have just a single possible QuerySolution. Historically for the classic plan cache, queries which specified a hint were ineligible for plan caching. I'm guessing this was because 1) the initial implementation of the classic plan cache wouldn't have worked correctly for queries with a hint, and 2) it didn't matter anyway since the main purpose of the classic plan cache was to avoid multi-planning. In contrast, this could actually make a difference for SBE due to the relatively higher cost of query compilation.

The work for this ticket is to cache queries with a hint in the SBE plan cache. I would recommend that we leave the classic plan cache as is, so that the change applies only to the SBE plan cache. My guess is that this should more or less work out of the box as long as we are careful to start encoding the hint into the SBE plan cache key.



 Comments   
Comment by Jess Balint [ 10/Jun/22 ]

we don't yet have a representation for hints in ABT which makes this difficult

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