@@ -108,7 +108,8 @@ document similar to the following:
108
108
<number>,
109
109
...
110
110
],
111
- "indexFilterSet" : <boolean>
111
+ "indexFilterSet" : <boolean>,
112
+ "estimatedSizeBytes" : <num> // Available starting in MongoDB 4.2.12, 4.0.23, 3.6.23
112
113
}
113
114
114
115
Each document includes various query plan and execution stats,
@@ -123,7 +124,9 @@ including:
123
124
124
125
* - ``createdFromQuery``
125
126
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
127
130
this cache entry; i.e.
128
131
129
132
.. code-block:: javascript
@@ -161,9 +164,11 @@ including:
161
164
currently available indexes for that shape. For more information, see
162
165
:data:`explain.queryPlanner.planCacheKey`
163
166
164
- * - ``cachedPlan``
167
+ * - :ref:`cachedPlan <plancachestats-cachedPlan>`
168
+
169
+ - .. _plancachestats-cachedPlan:
165
170
166
- - The details of the cached plan. See :data:`explain.queryPlanner`.
171
+ The details of the cached plan. See :data:`explain.queryPlanner`.
167
172
168
173
* - ``works``
169
174
@@ -175,24 +180,36 @@ including:
175
180
* - ``timeOfCreation``
176
181
- Time of creation for the entry.
177
182
178
- * - ``creationExecStats``
183
+ * - :ref:`creationExecStats <plancachestats-creationExecStats>`
184
+
185
+ - .. _plancachestats-creationExecStats:
179
186
180
- - An array of execution stats documents. The array contains a
187
+ An array of execution stats documents. The array contains a
181
188
document for each candidate plan.
182
189
183
190
For details on the execution stats, see
184
191
:data:`explain.executionStats`.
185
192
186
- * - `` candidatePlanScores` `
193
+ * - :ref:` candidatePlanScores <plancachestats-candidatePlanScores> `
187
194
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
189
198
``creationExecStats`` array.
190
199
191
200
* - ``indexFilterSet``
192
201
193
202
- A boolean that indicates whether the an :ref:`index filter
194
203
<index-filters>` exists for the query shape.
195
204
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
+
196
213
Examples
197
214
--------
198
215
@@ -275,7 +292,8 @@ The operation returns all entries in the cache:
275
292
1.5003000000000002,
276
293
1.5003000000000002
277
294
],
278
- "indexFilterSet" : false
295
+ "indexFilterSet" : false,
296
+ "estimatedSizeBytes" : NumberLong(3160) // Available starting in MongoDB 4.2.12, 4.0.23, 3.6.23
279
297
}
280
298
{ // Plan Cache Entry 2
281
299
"createdFromQuery" : {
@@ -303,7 +321,8 @@ The operation returns all entries in the cache:
303
321
1.0003000000000002,
304
322
1.0003000000000002
305
323
],
306
- "indexFilterSet" : false
324
+ "indexFilterSet" : false,
325
+ "estimatedSizeBytes" : NumberLong(2539) // Available starting in MongoDB 4.2.12, 4.0.23, 3.6.23
307
326
}
308
327
{ // Plan Cache Entry 3
309
328
"createdFromQuery" : {
@@ -331,7 +350,8 @@ The operation returns all entries in the cache:
331
350
1.7503000000000002,
332
351
1.7503000000000002
333
352
],
334
- "indexFilterSet" : false
353
+ "indexFilterSet" : false,
354
+ "estimatedSizeBytes" : NumberLong(3183) // Available starting in MongoDB 4.2.12, 4.0.23, 3.6.23
335
355
}
336
356
{ // Plan Cache Entry 4
337
357
"createdFromQuery" : {
@@ -363,7 +383,8 @@ The operation returns all entries in the cache:
363
383
1.6669666666666665,
364
384
1.6669666666666665
365
385
],
366
- "indexFilterSet" : false
386
+ "indexFilterSet" : false,
387
+ "estimatedSizeBytes" : NumberLong(4653) // Available starting in MongoDB 4.2.12, 4.0.23, 3.6.23
367
388
}
368
389
369
390
See also :ref:`plan-cache-key`.
@@ -415,7 +436,7 @@ specific information for a particular query shape:
415
436
416
437
.. code-block:: javascript
417
438
418
- db.orders.aggregate( [
439
+ db.orders.aggregate( [
419
440
{ $planCacheStats: { } },
420
441
{ $match: { planCacheKey: "DD67E353"} }
421
442
] )
@@ -424,7 +445,7 @@ The operation returns the following:
424
445
425
446
.. code-block:: javascript
426
447
:copyable: false
427
-
448
+
428
449
{
429
450
"createdFromQuery" : {
430
451
"query" : { "quantity" : { "$gte" : 5 }, "type" : "apparel" },
@@ -589,7 +610,8 @@ The operation returns the following:
589
610
1.5003000000000002,
590
611
1.5003000000000002
591
612
],
592
- "indexFilterSet" : false
613
+ "indexFilterSet" : false,
614
+ "estimatedSizeBytes" : NumberLong(3160) // Available starting in MongoDB 4.2.12, 4.0.23, 3.6.23
593
615
}
594
616
595
617
See also :ref:`plan-cache-key` and :ref:`query-hash`.
0 commit comments