CBR: deterministically choose between all the plans that share the lowest cost

XMLWordPrintableJSON

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

      For some reason, if there are multiple plans that share the same cost, picking the first one does not guarantee that the same plan will be picked every time the same query is run. This is a problem for golden_tests where any plan flips will cause BFs.

      There are multiple uses of `unordered_map` in the plan enumerator, so I guess it is the input to CBR that is randomized.

      If a simple solution that does not involve full tie-breaking is implemented, that would be much appreciated.

      There are two cases where this currently happens:

      • if there are two indexes that cover the same field and a predicate on said field, either index may be chosen because they all have the same costs regardless of index scan direction or whether the index is compound or not
      • if there is an `OR` in the plan, the plan enumerator may generate two plans that each have the inputs to `OR` in different order. Those two plans will have the same cost and therefore either one can be chosen.

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

                Created:
                Updated: