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

Inject cardinality estimates

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

      In order to decouple the development of this project from CE projects, and to enable testing of this project, as well as cost estimation with exact CE, it is very useful to implement injection of CEs.

      This task should:

      • Find a user-friendly way to specify cardinality and/or selectivity estimates for individual predicates.
      • The implementation should not be too complex - for instance, and implementation based on a new hints syntax will likely be way too complex.
      • Implement a CE-like module that internally provides an interface to CBR to request estimates of MatchExpressions (and eventually intervals) in a way similar to the other CE modules.
      • Also provide a way to set overall collection cardinality.

      As a result CBR should be able to run transparently with "injected" cardinality/selectivity estimates.

      The reason I suggest to consider selectivity along with cardinality, is that often it is easier to thing in terms of selectivities, especially when there is an existing collection.

      There are few implementation ideas:

      • Add a query knob similar to cost constants in Bonsai. This is quite limited, because the knobs are server-wide, and also it will be hard to associate estimates with predicates.
      • Use persistent query settings infrastructure.
      • Implement a simple form of sampling that runs each predicate against the full collection. This could be controlled by one query knob.

      There surely are other ways to do it.

            Assignee:
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Reporter:
            timour.katchaounov@mongodb.com Timour Katchaounov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: