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

Trim predicates off CollectionScanNode if they are expressible directly as bounds on RecordStore's primary key

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

      Related ticket SERVER-54008 extends our CollectionScan node in the classic execution engine to support bounded scans, which is useful when the collection is clustered on some field. In particular, time series collections will be clustered on _id, though we could theoretically support this clustered index format for additional scenarios in the future.

      Today, the query planner will always attach the full match expression as a filter on the CollectionScan, even if that predicate is expressible exactly as bounds. As an example, let's say that query rewrites result in an _internalExprGte:x predicate on the _id. This predicate could be expressed as [x, MaxKey] bounds on the CollectionScanNode, meaing that the _internalExprGte:x predicate could be removed so that it is not evaluated at runtime. We have logic to do exactly this "trimming" for predicates with exact bounds tightness when converted into regular index bounds, but we are missing such logic for bounded collection scans.

      This ticket should not be done until after SERVER-54398, which will first add support to the query planner for generating bounded collscan plans.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: