Avoid double-counting of reapplied equivalent predicates

    • Type: Task
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      If a more complex predicate is completely evaluated by e.g. AND_SORTED and there is no residual predicate for FETCH to evaluate, the cardinality estimate should be equal to the estimate of the input stage.

       

         winningPlan: {
          isCached: false,
          stage: 'FETCH',
          cardinalityEstimate: 0.0023713737056616554, <<<< INCORRECT
          costEstimate: 0.04108509091715634,
          estimatesMetadata: { ceSource: 'Histogram' },
          filter: {
            '$and': [ { a: { '$eq': 1 } }, { b: { '$eq': 1 } } ]
          },
          inputStage: {
            stage: 'AND_SORTED',
            cardinalityEstimate: 0.0316227766016838,
            costEstimate: 0.0291674,
            estimatesMetadata: { ceSource: 'Histogram' },
      

       

              Assignee:
              Unassigned
              Reporter:
              Philip Stoev
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: