[SERVER-19835] SubplanStage should not cache plan for an individual $or branch if plans tie or there are no query results Created: 07/Aug/15  Updated: 19/Sep/15  Resolved: 11/Aug/15

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 3.1.2
Fix Version/s: 3.1.7

Type: Bug Priority: Major - P3
Reporter: David Storch Assignee: David Storch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-18777 CachedPlanStage replanning mechanism ... Backlog
is related to SERVER-15225 CachedPlanStage should execute for tr... Closed
Backwards Compatibility: Fully Compatible
Sprint: QuInt 8 08/28/15
Participants:

 Description   

Versions 2.6.x and 3.0.x will not create a plan cache entry for a query shape if, during plan selection, either

  1. the winning plan ties with the runner-up, or
  2. the winning plan does not produce any results during the MultiPlanStage trial period.

The intention behind this behavior is that in these edge cases the system has low confidence that it has selected the best plan. In order to avoid re-using the wrong plan from the cache for a subsequent execution of the query shape, the system refrains from creating a potentially erroneous cache entry.

In version 3.1.2 under SERVER-15225, behavior was introduced to aggressively evict bad cache entries. This aggressive eviction obviated the need for not caching in case of ties or zero results, and therefore the system changed to always create a cache entry.

However, due to a detail in the implementation of the SubplanStage, $or queries which use the subplan path do not benefit from SERVER-15225's plan cache eviction logic. This means that subplanned queries can experience a performance regression in which they choose the wrong plan in 3.1.x unstable releases greater than or equal to 3.1.2.

We should correct this regression by re-introducing the "don't cache ties or zero result queries", just for queries that use the SubplanStage.



 Comments   
Comment by Githook User [ 11/Aug/15 ]

Author:

{u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}

Message: SERVER-19835 change SubplanStage to skip creation of a plan cache entry in edge cases

Since the SubplanStage does not benefit from the CachedPlanStage's replanning, it should not create
a cache entry if there is a plan ranking tie or if zero results are produced during the plan ranking
trial period.
Branch: master
https://github.com/mongodb/mongo/commit/3f8b8b495fbe5303bb39dcd2ba5708275f482d2e

Comment by David Storch [ 07/Aug/15 ]

Note that the work planned for this ticket is intended to provide a stopgap fix for the regression until we find a satisfactory solution for SERVER-18777. That is, a more complete fix would introduce the cached plan eviction and replanning logic to the SubplanStage.

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