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

Handle trivially false queries which attempt an index scan

    • Query Optimization
    • Fully Compatible
    • v8.0
    • 200

      In SERVER-70477 filters which will never match anything e.g., $in: [] are replaced with AlwaysFalseMatchExpression.

      And in SERVER-81863, queries which generate a colscan and are always false, emit an EofNode.
      However, queries which would otherwise generate an ixscan are not handled in this manner.

      This resulted in BF-32974, as while the queries there would indeed never match anything, they still performed an index scan (satisfying a sort). The performance regression came from no longer being able to bound the scan based on other predicates if the whole filter was simplified down to AlwaysFalseMatchExpression, and instead fetched and filtered (with $alwaysFalse).

      If it is known that the filter will not match anything, ever, the solution can be reduced to an EofNode, in the same manner as with colscans.

            Assignee:
            james.harrison@mongodb.com James Harrison
            Reporter:
            james.harrison@mongodb.com James Harrison
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: