[SERVER-37194] Number of docsExamined is not considered for index selection Created: 18/Sep/18  Updated: 11/Sep/23  Resolved: 11/Sep/23

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

Type: Improvement Priority: Critical - P2
Reporter: Alexander Komyagin Assignee: Backlog - Query Optimization
Resolution: Duplicate Votes: 2
Labels: bonsai, query-44-grooming
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-79400 Implement number of documents tie bre... Closed
Related
related to SERVER-14423 Plans which fetch different numbers o... Closed
Assigned Teams:
Query Optimization
Participants:

 Description   

We should consider the number of documents scanned between different plans being evaluated. At the very least, we should use that to resolve ties between plans.

This is critical for Big Data systems reading data via Spark Connector that partitions data by _id for reading. Example:

For the query

{date:{$gte:A}, _id:{$gte:B}, email:{$gte:C}}

all indexes below will tie, although it is beyond obvious which one should be selected (the difference is of course dramatic when we're talking about TB's of data):

{date:1, _id:1}
{date:1, _id:1, email:1}
{date:1, _id:1, some_other_email:1}



 Comments   
Comment by Alexander Ignatyev [ 11/Sep/23 ]

The fix was implemented in PM-3316 via SERVER-79400.

Generated at Thu Feb 08 04:45:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.