The size of the plan cache for each collection is currently set to 200. This may be too small. For example, if an application generates lots of $all queries, we will consider queries with different numbers of elements in the $all as separate query shapes:
> t.ensureIndex({a: 1})
WriteResult({ "nInserted" : 1 })
> t.ensureIndex({b: 1})
WriteResult({ "nInserted" : 1 })
> t.find({a: 1, b: {$all: [1, 2]}})
> t.find({a: 1, b: {$all: [1, 2, 3]}})
> t.getPlanCache().listQueryShapes()
[
{
"query" : {
"a" : 1,
"b" : {
"$all" : [
1,
2,
3
]
}
},
"sort" : {
},
"projection" : {
}
},
{
"query" : {
"a" : 1,
"b" : {
"$all" : [
1,
2
]
}
},
"sort" : {
},
"projection" : {
}
}
]
>
We may want to increase the size of the cache for this reason in order to accommodate larger numbers of query shapes.