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

Reorder predicates in a Filter node based on selectivity

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

      When the most selective conditions in a conjunction are evaluated first, this reduces the likelihood that the subsequent conditions will need to be evaluated at all due to Boolean short-circuit logic. Therefore it is beneficial to order the terms of a conjunction according to their selectivity. This ordering assumes that all terms have approximately equal cost, which is true for all range comparison operations. When some day we will consider expensive predicates the ordering should be done based on the ratio of selectivity and cost (or rank).

      Since predicate order is a physical property, and cost is a physical property as well, this reordering should be done during the implementation phase, when logical nodes are implemented via specific physical nodes.

      Currently this reordering is performed during the implementation of SargableNode, via the call to function lowerPartialSchemaRequirements().

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            anton.korshunov@mongodb.com Anton Korshunov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: