Join Order Optimization: expose intermediate and final cardinality estimates and costs in explain()

XMLWordPrintableJSON

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

      To enable proper testing, costs and cardinalities need to be exposed in the explain, both the ones of the intermediate joins and of the final query.

      A mock example:

      Enterprise tpch> db.part.aggregate([{"$lookup":{"from":"partsupp","localField":"p_partkey","foreignField":"ps_partkey","as":"partsupp"}}]).explain();
      {
        explainVersion: '2',
        queryPlanner: {
          ...
          winningPlan: {
            ...
            costEstimate: AAA # Cost estimate for the entire plan
            cardinalityEstimate: BBB # Cardinality estimate for the entire plan;
            ... 
            queryPlan: {
              stage: 'EQ_LOOKUP',
              costEstimate: XXX # Cost estimate for this particular join
              cardinalityEstimate: YYY # Cardinality estimate for this particular join
        ...
      

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

              Created:
              Updated:
              Resolved: