indexBasedCE: unable to estimate AND_SORTED nodes with cardinalityEstimate > 0

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      `AND_SORTED` has been disabled by default in production, but is still enabled in CI. However, indexBasedCE is unable to estimate such nodes (unless their cardinality is zero, in which case the ceSource is not indexBasedCE but is "Code".

      To reproduce:

      db.adminCommand({setParameter: 1, internalQueryPlannerEnableSortIntersection: True} ;
      db.foo.drop();
      for (let i = 0; i < 1000; i++) { db.foo.insert({a:1, b:1}); }
      db.foo.createIndex({a:1});
      db.foo.createIndex({b:1});
      db.adminCommand({setParameter: 1, planRankerMode: "indexBasedCE"});
      db.foo.find({a:1, b: 1});
      
      
      

      results in:

      MongoServerError[CEFailure]: Unable to estimate expression 

              Assignee:
              Hana Pearlman
              Reporter:
              Philip Stoev
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: