-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Optimization
-
None
-
None
-
None
-
None
-
None
-
None
-
None
The purpose of the product_limits test is to run queries that are very stressful to the server.
As Max rightfully observed, the WorkloadAndOverSingleField uses a predicate that is simplified to a trivial index range in the presence of an index:
db.foo.aggregate([{$match: {$and: [{i: {$lt: 1000}}, {i: {$lt: 1001}}, {i: {$lt: 1002}}]}}]).explain();
{
inputStage: {
...
indexBounds: { i: [ '[-inf, 1000)' ] }
}
}
A single `indexBounds` is created and the predicate in its entirety is never evaluated anywhere within the query, making the test less stressful than it could be.
Contrast with the same workload run against a collection with no index:
filter: {
'$and': [
{ i: { '$lt': 1 } },
{ i: { '$lt': 2 } },
{ i: { '$lt': 3 } }
]
},
The predicate is preserved and will be evaluated in its entirety.
So we need some predicate and/or dataset that is also stressful in the indexed case.