$match on field projected to a contradictory constant value should EOF

XMLWordPrintableJSON

    • Query Optimization
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Example query: say you have a view like:

      [... \{$project: {a: null}}, \{$unionWith: {... /*has a non-null a somehow*/}}]

      And a predicate like: {$match: {a: {$gt: 3}}}

      We should be able to reduce the pipeline prefix of the $unionWith to an EOF plan, because we are projecting a to a constant that can never match the predicate. In the worst case, we could end up with this view processing many documents for the pipeline prefix, only to discard them all, before running a $unionWith.

      SERVER-105449 would help this by pushing down the computed projection on a further, but it would still potentially scan the whole base collection.

            Assignee:
            Unassigned
            Reporter:
            Alya Berciu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: