[SERVER-22867] Plan enumerator should convey to access planner when it is safe to intersect bounds Created: 25/Feb/16  Updated: 16/Mar/16  Resolved: 04/Mar/16

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

Type: Task Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Max Hirschhorn
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-22401 Implement index bounds generation rul... Closed
Backwards Compatibility: Fully Compatible
Sprint: Query 11 (03/14/16)
Participants:

 Description   

The access planner has code to avoid intersecting bounds of leaf expressions when the index is multikey. This prevents the access planner from inadvertently intersecting bounds for a self-intersection index plan on a multikey index.

if (boundsToFillOut->fields[pos].name.empty()) {
    // The bounds will be compounded. This is OK because the
    // plan enumerator told us that it is OK.
    return true;
} else {
    if (MatchExpression::AND == mergeType) {
        // The bounds will be intersected. This is OK provided
        // that the index is NOT multikey.
        return !index.multikey;
    } else {
        // The bounds will be unionized.
        return true;
    }
}

The changes from SERVER-22401 will make it possible to generate an assignment where it is possible to intersect bounds on fields where no prefix causes the index to be multikey. We should change the plan enumerator to convey to the access planner that it is possible to intersect bounds in some circumstances, even when the index is multikey. This will involve adding an additional member and plumbing it through OneIndexAssignment --> IndexTag --> PlanCacheIndexTree. The information needs to be stored in PlanCacheIndexTree so that we correctly decide when it is possible to intersect bounds for plans created from the plan cache.



 Comments   
Comment by Githook User [ 04/Mar/16 ]

Author:

{u'username': u'visemet', u'name': u'Max Hirschhorn', u'email': u'max.hirschhorn@mongodb.com'}

Message: SERVER-22867 Convey to access planner when to intersect bounds.

The plan enumerator is already aware of the rules for intersecting and
compounding bounds with multikey indexes. By making this information
part of the index assignment, the access planner can know whether it
should intersect the bounds or generate a self-intersection plan.

This change avoids creating duplicate work in the access planner that
already has to exist in the plan enumerator when the rules for
intersecting and compounding bounds becomes based on what prefixes of
indexed fields cause the index to be multikey.
Branch: master
https://github.com/mongodb/mongo/commit/7467ccea16a70e514f5044866e56c8c4ebb0ad80

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