-
Type: New Feature
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Fully Compatible
-
Query Optimization 2021-07-26, Query Optimization 2021-08-09, QO 2021-08-23
Currently when you use $geoWithin on a time-series collection, it can only be pushed down if the predicate is on a metadata field. We'd like to also push down geo predicates on measurements.
But $geoWithin can't express this bucket-level predicate. We should introduce a new internal-only operator, say "$_internalBucketGeoWithin", that can discard buckets that definitely don't contain points in the given region.
For example:
{$_internalUnpackBucket: ...} {$match: {location: {$geoWithin: ...}}}
could be optimized to something like:
{$match: {$_internalBucketGeoWithin: {
withinRegion: ...,
field: "location",
...
}}}
{$_internalUnpackBucket: ...}
{$match: {location: {$geoWithin: ...}}}
The implementation could use control.min.location / control.max.location to quickly discard many buckets.
This ticket is only about creating the new operator. Optimization and indexing will be separate.
- is depended on by
-
SERVER-57764 Push down $geoWithin past $_internalUnpackBucket
- Closed
-
SERVER-57765 Allow partial filter expression to use $_internalBucketGeoWithin
- Closed
-
SERVER-58371 Allow $_internalBucketGeoWithin to scan 'bucket-2dsphere' index
- Closed
- is related to
-
SERVER-60445 $_internalBucketGeoWithin on mixed types can miss some events
- Closed