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

Collection scan bounds for clustered collections should allow for exclusivity

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

      Timeseries collections are clustered by the _id field. To take advantage of this property, SERVER-54008 has extended the query system to execute plans which scan ranges of a collection. Prior to this change, collection scan plans generally needed to scan the entire collection, rather than scanning a range of record ids bounded by [recordIdMin, recordIdMax].

      The implementation from SERVER-54008 currently assumes that the min and max record id bounds are always inclusive. It does not support exclusive bounds on either side, such as (recordIdMin, recordIdMax], [recordIdMin, recordIdMax), or (recordIdMin, recordIdMax). It would make sense to allow exclusive bounds in order to bring COLLSCAN bounds more in line with IXSCAN bounds. This would also make sense in order to enable more predicates to be "trimmed" as suggested by SERVER-54715.

      As an implementation note, louis.williams and myself agreed that a likely implementation would enforce exclusivity on the query side rather than as part of the storage API. That is, the scan operator implemented by query would continue to use SeekableRecordCursor::seekNear(), but would be careful skip over the records at the endpoints if the bounds are exclusive.

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

              Created:
              Updated: