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

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • Query Optimization

    Description

      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[])?

      Attachments

        Activity

          People

            backlog-query-optimization Backlog - Query Optimization
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: