-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Query Optimization
-
Fully Compatible
-
QO 2023-05-29, QO 2023-06-12
Sometimes we generate plans that involve more than one index scan, and one or more of those scans has no bounds--it scans the whole index. Are these plans useful?
If index scans and collection scans have similar cost, then a single collection scan + filter should be cheaper than multiple full index scans. So we may want a heuristic to prevent union or intersection involving a full index scan.
On the other hand, a collection scan may be much more expensive than an index scan, and the more complex indexed plan can help fetch fewer documents. So if we add this heuristic, we should have an internal-only query knob to decide whether to apply it.