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

Skip Filter->Sargable rewrite for collscan plans

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible
    • QO 2023-12-25, QO 2024-01-08

      A primary goal of a Sargable node is to provide a facility for solving an access path selection problem in Bonsai. In the absense of indexes in a collection there is no need to perform this conversation as we won't be doing any access path selection work, and eventually we will get from Filter to Sargable and back to Filter node. However, a Sargable node presently participates in other optimizations, such as predicate reoredeing based on selectivity or top-level fields pushdown. If these optimizations could be "extracted" from the Sargable node and implemented as stand-alone rewrites, we could skip this rewrite when we know that we're about to generate a collection scan plan. Another interesting optimization done by the Sargable node is interval simplification (e.g., a > x && a > y becomes a > max(x, y)). However, this simplification can only be done if we know that a given path is non-multikey, and without indexes this information is not available, meaning we cannot simplify such intervlas. The only case when we can do that is a predicate within $elemMatch. We will support this case when we extend the boolean simplifier to support interval simplification so that we can perform this optimization much earlier and w/o the need to create a Sargable node.

            Assignee:
            timour.katchaounov@mongodb.com Timour Katchaounov
            Reporter:
            anton.korshunov@mongodb.com Anton Korshunov
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: