@@ -108,7 +108,8 @@ document similar to the following:
108108 <number>,
109109 ...
110110 ],
111- "indexFilterSet" : <boolean>
111+ "indexFilterSet" : <boolean>,
112+ "estimatedSizeBytes" : <num> // Available starting in MongoDB 4.2.12, 4.0.23, 3.6.23
112113 }
113114
114115Each document includes various query plan and execution stats,
@@ -123,7 +124,9 @@ including:
123124
124125 * - ``createdFromQuery``
125126
126- - A document that contains the specific query that resulted in
127+ - .. _plancachestats-createdFromQuery:
128+
129+ A document that contains the specific query that resulted in
127130 this cache entry; i.e.
128131
129132 .. code-block:: javascript
@@ -161,9 +164,11 @@ including:
161164 currently available indexes for that shape. For more information, see
162165 :data:`explain.queryPlanner.planCacheKey`
163166
164- * - ``cachedPlan``
167+ * - :ref:`cachedPlan <plancachestats-cachedPlan>`
168+
169+ - .. _plancachestats-cachedPlan:
165170
166- - The details of the cached plan. See :data:`explain.queryPlanner`.
171+ The details of the cached plan. See :data:`explain.queryPlanner`.
167172
168173 * - ``works``
169174
@@ -175,24 +180,36 @@ including:
175180 * - ``timeOfCreation``
176181 - Time of creation for the entry.
177182
178- * - ``creationExecStats``
183+ * - :ref:`creationExecStats <plancachestats-creationExecStats>`
184+
185+ - .. _plancachestats-creationExecStats:
179186
180- - An array of execution stats documents. The array contains a
187+ An array of execution stats documents. The array contains a
181188 document for each candidate plan.
182189
183190 For details on the execution stats, see
184191 :data:`explain.executionStats`.
185192
186- * - `` candidatePlanScores` `
193+ * - :ref:` candidatePlanScores <plancachestats-candidatePlanScores> `
187194
188- - An array of scores for the candidate plans listed in the
195+ - .. _plancachestats-candidatePlanScores:
196+
197+ An array of scores for the candidate plans listed in the
189198 ``creationExecStats`` array.
190199
191200 * - ``indexFilterSet``
192201
193202 - A boolean that indicates whether the an :ref:`index filter
194203 <index-filters>` exists for the query shape.
195204
205+ * - ``estimatedSizeBytes``
206+
207+ - A number that describes the estimated size in bytes of a plan
208+ cache entry.
209+
210+ .. versionadded:: 4.2.12 (*and 4.0.23 and 3.6.23*)
211+
212+
196213Examples
197214--------
198215
@@ -275,7 +292,8 @@ The operation returns all entries in the cache:
275292 1.5003000000000002,
276293 1.5003000000000002
277294 ],
278- "indexFilterSet" : false
295+ "indexFilterSet" : false,
296+ "estimatedSizeBytes" : NumberLong(3160) // Available starting in MongoDB 4.2.12, 4.0.23, 3.6.23
279297 }
280298 { // Plan Cache Entry 2
281299 "createdFromQuery" : {
@@ -303,7 +321,8 @@ The operation returns all entries in the cache:
303321 1.0003000000000002,
304322 1.0003000000000002
305323 ],
306- "indexFilterSet" : false
324+ "indexFilterSet" : false,
325+ "estimatedSizeBytes" : NumberLong(2539) // Available starting in MongoDB 4.2.12, 4.0.23, 3.6.23
307326 }
308327 { // Plan Cache Entry 3
309328 "createdFromQuery" : {
@@ -331,7 +350,8 @@ The operation returns all entries in the cache:
331350 1.7503000000000002,
332351 1.7503000000000002
333352 ],
334- "indexFilterSet" : false
353+ "indexFilterSet" : false,
354+ "estimatedSizeBytes" : NumberLong(3183) // Available starting in MongoDB 4.2.12, 4.0.23, 3.6.23
335355 }
336356 { // Plan Cache Entry 4
337357 "createdFromQuery" : {
@@ -363,7 +383,8 @@ The operation returns all entries in the cache:
363383 1.6669666666666665,
364384 1.6669666666666665
365385 ],
366- "indexFilterSet" : false
386+ "indexFilterSet" : false,
387+ "estimatedSizeBytes" : NumberLong(4653) // Available starting in MongoDB 4.2.12, 4.0.23, 3.6.23
367388 }
368389
369390See also :ref:`plan-cache-key`.
@@ -415,7 +436,7 @@ specific information for a particular query shape:
415436
416437.. code-block:: javascript
417438
418- db.orders.aggregate( [
439+ db.orders.aggregate( [
419440 { $planCacheStats: { } },
420441 { $match: { planCacheKey: "DD67E353"} }
421442 ] )
@@ -424,7 +445,7 @@ The operation returns the following:
424445
425446.. code-block:: javascript
426447 :copyable: false
427-
448+
428449 {
429450 "createdFromQuery" : {
430451 "query" : { "quantity" : { "$gte" : 5 }, "type" : "apparel" },
@@ -589,7 +610,8 @@ The operation returns the following:
589610 1.5003000000000002,
590611 1.5003000000000002
591612 ],
592- "indexFilterSet" : false
613+ "indexFilterSet" : false,
614+ "estimatedSizeBytes" : NumberLong(3160) // Available starting in MongoDB 4.2.12, 4.0.23, 3.6.23
593615 }
594616
595617See also :ref:`plan-cache-key` and :ref:`query-hash`.
0 commit comments