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

[CQF] Add predicates to SargableNode about fields which are implied by existing predicates on dotted fields

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

      Consider a non-multikey index on {a: 1} and the query {a: {b: 123{}}. We might end up with a SargableNode with requirements PathGet [a] PathGet [b] PathIdentity [] = 123. We will consider a plan which does an IXSCAN + SEEK, with no bounds onĀ 

      {a: 1}

      . However, because we know the predicate in the query implies that a is an object, we can actually produce tighter bounds on the IXSCAN [{}, []] over a. See BSON sort ordering.

      The purpose of this ticket is to explore whether we can achieve these tighter index bounds. One solution could add a rewrite that adds (perfOnly?) partial schema requirements to SargableNodes on fields which are implied by existing requirements. Another options could be to modify the index bounds generation to take into account these types.

      Another area to think about is if we can do a similar transformation for multikey indexes (PathGet[a] PathTraverse[1] PathGet[b] PathIdentity[])?

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: