-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: 5.0.2
-
Component/s: None
-
None
-
Query Optimization
-
ALL
-
On a collection of 4.3 GB, with an index of 14.8 MB, the query planner chooses a collection scan over a covered index scan.
> db.system.buckets.point_data.find({},{"meta":1, "control.max.time":1,_id:0},).hint({meta:1,"control.min.time":1,"control.max.time":1}).itcount()}}
This query takes 3.4s, but without the hint it take 40s.
The collection here is the system.buckets.point_data collection for a time-series collection, but the issue is not specific to time-series.
I understand that often a collection scan can be faster, but in this case the 290x size difference between the index and the collection size should have been decisive. Anyway, it doesn't look like the index scan was considered at all here.
- is caused by
-
SERVER-23406 index scan is slower than full collection scan in some scenarios
- Backlog
- is related to
-
SERVER-58276 Add time-series bounded collection scan plans to query multi-planner
- Closed
- related to
-
SERVER-20066 Query planner should consider index scans on empty query predicates
- Closed