ExportXMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • QE 2026-10-26
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Currently there is no insight into the actual q-error / quality of the CE. This ticket should implement the measurement of the q-error (max(real/estimated, estimated/real)). This data should be written to query stats as a histogram based on what was actually observed for a cardinality during execution and what was estimated. In the case when no estimates are available (e.g. if the plan was chosen by MP or the query was not fully executed) then nothing should be recorded. The bound of the histogram buckets should be determined by evaluating data from SyntheticBenchmarks by forcing CBR on (vanilla CBR).

      The cost model that actually does the cost estimate is in src/mongo/db/query/compiler/optimizer/cost_based_ranker/cost_estimator.cpp

      Following q errors for the fields should be determined:

      for clustered collection scans:
      – number of estimed records out (OutCE)

      For IndexScans:
      – number of docs (outCE)
      – number of keys scanned (inCE)
      – Number of seeks (seekEst)

      Collection scans with filters
      – number of documents (outCE)

      Fetch with filters
      – number of documents (outCE)

      These values are already collected by explain but could potentially not be collected if the query is nor running in explain.

      The collection if this data should not use Otel.

            Assignee:
            Serhii Lysenko
            Reporter:
            Peter Volk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: