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

[CQF] Include source of cardinality estimates in logical properties

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible

      When we estimate individual predicates, we put the results in a logical property:

              "|   |   Logical:\n"
              "|   |       cardinalityEstimate: \n"
              "|   |           ce: 189.571\n"
              "|   |           requirementCEs: \n"
              "|   |               refProjection: root, path: 'PathGet [a] PathIdentity []', ce: 330\n"
              "|   |               refProjection: root, path: 'PathGet [b] PathGet [c] PathIdentity "
              "[]', ce: 330\n"
      

      https://github.com/10gen/mongo/blob/7ab5c60c1c99ac7ecfbf9e79d5de08dd29fcb37a/src/mongo/db/query/optimizer/physical_rewriter_optimizer_test.cpp#L3299-L3301

      Let's also include a string describing which CE method was used.

      • Change the deriveCE() method to return pair<CEType, std::string>.
      • Each CE implementation should return a short string like "heuristic" or "sampling".
      • When one CE implementation delegates to another (like when sampling falls back to heuristic) we should report the ultimate source of the CEType (heuristic) and not the wrapper.
      • Update the PartialSchemaKeyCE structure (in CardinalityEstimate) to hold the string for each estimate.
      • Update explain.

            Assignee:
            daniel.segel@mongodb.com Daniel Segel
            Reporter:
            david.percy@mongodb.com David Percy
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: