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

Avoid double-counting of reapplied equivalent predicates

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

      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:
            timour.katchaounov@mongodb.com Timour Katchaounov
            Reporter:
            philip.stoev@mongodb.com Philip Stoev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: