[SERVER-79400] Implement number of documents tie breaking heuristics Created: 27/Jul/23  Updated: 31/Jan/24  Resolved: 25/Aug/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0, 7.0.6

Type: Task Priority: Major - P3
Reporter: Alexander Ignatyev Assignee: Katie Yang (Inactive)
Resolution: Fixed Votes: 0
Labels: auto-reverted, bkp
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Duplicate
duplicates SERVER-14423 Plans which fetch different numbers o... Closed
duplicates SERVER-37194 Number of docsExamined is not conside... Closed
Problem/Incident
Backwards Compatibility: Fully Compatible
Backport Requested:
v7.0, v6.0
Sprint: QO 2023-08-07, QO 2023-08-21, QO 2023-09-04
Participants:
Linked BF Score: 161

 Description   

In case if several candidate plans achieved the same highest score, prefer a plan which fetches a smaller number of documents.

Implementation details:
In pickBestPlan function, right after we sort candidate plans:
1. Identified the tied plans
2. Compare the tied plans by number of examined documents
3. Increase score for the plan with fewer examined documents by epsilon value (which is defined above as a constant equals to 1e-4)
4. re-sort the plans



 Comments   
Comment by Githook User [ 31/Jan/24 ]

Author:

{'name': 'Katie Yang', 'email': 'katie.yang@mongodb.com', 'username': ''}

Message: SERVER-79400 Implement tie breaking by number of documents examined

(cherry picked from commit 635896212da75f54af49272cb8dba0d95c270262)

GitOrigin-RevId: 83c24f81f7f2034e43a8cfacb943c96b181936fc
Branch: v7.0
https://github.com/mongodb/mongo/commit/d27c5bdb87a0499a8402cc9493516ac967db0c82

Comment by Githook User [ 25/Aug/23 ]

Author:

{'name': 'Katie Yang', 'email': 'katie.yang@mongodb.com', 'username': ''}

Message: SERVER-79400 Implement tie breaking by number of documents examined
Branch: master
https://github.com/mongodb/mongo/commit/635896212da75f54af49272cb8dba0d95c270262

Comment by xgen-buildbaron-user [ 23/Aug/23 ]

Ticket re-opened due to revert. cqf_experimental_no_passthrough began a consistent failure of jstests/noPassthrough/multiplanner_tie_breaking.js

Comment by Githook User [ 23/Aug/23 ]

Author:

{'name': 'auto-revert-processor', 'email': 'dev-prod-dag@mongodb.com', 'username': ''}

Message: Revert "SERVER-79400 Implement tie breaking by number of documents examined"

This reverts commit cd704a63eecc581e5ebb7aa61931926968ef589c.
Branch: master
https://github.com/mongodb/mongo/commit/d00599923357ae5f8c25ba911c250552012d0325

Comment by Githook User [ 22/Aug/23 ]

Author:

{'name': 'Katie Yang', 'email': 'katie.yang@mongodb.com', 'username': ''}

Message: SERVER-79400 Implement tie breaking by number of documents examined
Branch: master
https://github.com/mongodb/mongo/commit/cd704a63eecc581e5ebb7aa61931926968ef589c

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