Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-84713

Ensure the child of a SargableNode is always a ScanNode after substitution phase

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization

      Currently, the child of a SargableNode is not always a ScanNode after the substitution phase. This happens when the SargableMerge fails to merge two SargableNode (e.g. one of them has non-singleton disjunction requirement) in the substitution phase. Such SargableNode will remain in memo until the exploration phase.

      Due to this, a SamplingEstimator may encounter such SargableNode and has to fall back to heuristic estimation without an additional check.
       
      To address that:

      1. Create a SubstituteConvert<SargableNode> rewrite which converts SargableNode back to a FilterNode like what ExploreConvert<Sargablenode> does today by calling lowerSargableNode(sargableNode, ctx).
      2. Update the TODO in the sampling_estimator.cpp into an assertion such that the child of a SargableNode is always a ScanNode.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            chii.huang@mongodb.com Chi-I Huang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: