-
Type:
Task
-
Resolution: Duplicate
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Optimization
-
QO 2023-02-06, QO 2023-02-20, QO 2023-03-06
-
None
-
None
-
None
-
None
-
None
-
None
-
None
The following query results in an optimization failure:
> db.adminCommand({setParameter: 1, internalQueryFrameworkControl: "forceBonsai"})
{ "was" : "tryBonsai", "ok" : 1 }
> db.foo.drop()
true
> db.foo.insert({a: 1})
WriteResult({ "nInserted" : 1 })
> db.foo.createIndex({a: 1})
{
"numIndexesBefore" : 1,
"numIndexesAfter" : 2,
"createdCollectionAutomatically" : false,
"ok" : 1
}
> db.foo.find({}, {a: 1}).hint({a: 1})
Error: error: {
"ok" : 0,
"errmsg" : "Optimization failed.",
"code" : 6808706,
"codeName" : "Location6808706"
}
> db.foo.find({a: 1}, {a: 1}).hint({a: 1})
{ "_id" : ObjectId("6364141d2262a3abfef2fb2e"), "a" : 1 }
So, we see an optimization failure when the query just has a projection, but the query succeeds when it has a filter and a projection.
This behavior is only visible when the hint is present, otherwise both queries succeed (they both choose a physical scan).
- is depended on by
-
SERVER-73194 [CQF] Allow hints to go through CQF
-
- Closed
-
- is duplicated by
-
SERVER-73194 [CQF] Allow hints to go through CQF
-
- Closed
-
- related to
-
SERVER-74403 Complete TODO listed in SERVER-71071
-
- Closed
-