-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
collStats.txt
394 lines (295 loc) · 12.4 KB
/
collStats.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
=========
collStats
=========
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. dbcommand:: collStats
The :dbcommand:`collStats` command returns a variety of storage statistics
for a given collection.
.. |command| replace:: ``collStats``
.. include:: /includes/fact-dbcommand.rst
The :dbcommand:`collStats` command has the following syntax:
.. code-block:: javascript
{
collStats: <string>,
scale: <int>,
verbose: <boolean>
}
The command takes the following fields:
.. list-table::
:header-rows: 1
:widths: 20 20 80
* - Field
- Type
- Description
* - ``collStats``
- string
- The name of the target collection.
If the collection does not exist, :dbcommand:`collStats` returns
an error message.
* - ``scale``
- int
- Optional. The scale used in the output to display the sizes of items. By default,
output displays sizes in bytes. To display kilobytes rather than bytes,
specify a ``scale`` value of ``1024``.
The scale factor rounds values to whole numbers.
* - ``verbose``
- boolean
- Optional. When ``true``, :dbcommand:`collStats` increases reporting for the
:ref:`storage-mmapv1`.
Defaults to false.
Behavior
--------
Accuracy after Unexpected Shutdown
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. |cmd| replace:: :dbcommand:`collStats`
.. |opt| replace:: size
.. include:: /includes/fact-unexpected-shutdown-accuracy.rst
Example
-------
The following operation runs the :dbcommand:`collStats` command on the
``restaurant`` collection, specifying a scale of ``1024`` bytes:
.. code-block:: javascript
db.runCommand( { collStats : "restaurant", scale: 1024 } )
The following document provides a representation of the
:dbcommand:`collStats` output. Depending on the configuration of your
collection and the storage engine, the output fields may include a
subset of the fields.
.. code-block:: javascript
{
"ns" : <string>,
"count" : <number>,
"size" : <number>,
"avgObjSize" : <number>,
"storageSize" : <number>,
"capped" : <boolean>,
"max" : <number>,
"maxSize" : <number>,
"wiredTiger" : {
"metadata" : {
"formatVersion" : <num>
},
"creationString" : <string>
"type" : <string>,
"uri" : <string>,
"LSM" : {
"bloom filters in the LSM tree" : <number>,
"bloom filter false positives" : <number>,
"bloom filter hits" : <number>,
"bloom filter misses" : <number>,
"bloom filter pages evicted from cache" : <number>,
"bloom filter pages read into cache" : <number>,
"total size of bloom filters" : <number>,
"sleep for LSM checkpoint throttle" : <number>,
"chunks in the LSM tree" : <number>,
"highest merge generation in the LSM tree" : <number>,
"queries that could have benefited from a Bloom filter that did not exist" : <number>,
"sleep for LSM merge throttle" : <number>
},
"block-manager" : {
"file allocation unit size" : <number>,
"blocks allocated" : <number>,
"checkpoint size" : <number>,
"allocations requiring file extension" : <number>,
"blocks freed" : <number>,
"file magic number" : <number>,
"file major version number" : <number>,
"minor version number" : <number>,
"file bytes available for reuse" : <number>,
"file size in bytes" : <number>
},
"btree" : {
"btree checkpoint generation" : <number>,
"column-store variable-size deleted values" : <number>,
"column-store fixed-size leaf pages" : <number>,
"column-store internal pages" : <number>,
"column-store variable-size leaf pages" : <number>,
"pages rewritten by compaction" : <number>,
"number of key/value pairs" : <number>,
"fixed-record size" : <number>,
"maximum tree depth" : <number>,
"maximum internal page key size" : <number>,
"maximum internal page size" :<number>,
"maximum leaf page key size" : <number>,
"maximum leaf page size" : <number>,
"maximum leaf page value size" : <number>,
"overflow pages" : <number>,
"row-store internal pages" : <number>,
"row-store leaf pages" : <number>
},
"cache" : {
"bytes read into cache" : <number>,
"bytes written from cache" : <number>,
"checkpoint blocked page eviction" : <number>,
"unmodified pages evicted" : <number>,
"page split during eviction deepened the tree" : <number>,
"modified pages evicted" : <number>,
"data source pages selected for eviction unable to be evicted" : <number>,
"hazard pointer blocked page eviction" : <number>,
"internal pages evicted" : <number>,
"pages split during eviction" : <number>,
"in-memory page splits" : <number>,
"overflow values cached in memory" : <number>,
"pages read into cache" : <number>,
"overflow pages read into cache" : <number>,
"pages written from cache" : 2
},
"compression" : {
"raw compression call failed, no additional data available" : <number>,
"raw compression call failed, additional data available" : <number>,
"raw compression call succeeded" : <number>,
"compressed pages read" : <number>,
"compressed pages written" : <number>,
"page written failed to compress" : <number>,
"page written was too small to compress" : 1
},
"cursor" : {
"create calls" : <number>,
"insert calls" : <number>,
"bulk-loaded cursor-insert calls" : <number>,
"cursor-insert key and value bytes inserted" : <number>,
"next calls" : <number>,
"prev calls" : <number>,
"remove calls" : <number>,
"cursor-remove key bytes removed" : <number>,
"reset calls" : <number>,
"search calls" : <number>,
"search near calls" : <number>,
"update calls" : <number>,
"cursor-update value bytes updated" : <number>
},
"reconciliation" : {
"dictionary matches" : <number>,
"internal page multi-block writes" : <number>,
"leaf page multi-block writes" : <number>,
"maximum blocks required for a page" : <number>,
"internal-page overflow keys" : <number>,
"leaf-page overflow keys" : <number>,
"overflow values written" : <number>,
"pages deleted" : <number>,
"page checksum matches" : <number>,
"page reconciliation calls" : <number>,
"page reconciliation calls for eviction" : <number>,
"leaf page key bytes discarded using prefix compression" : <number>,
"internal page key bytes discarded using suffix compression" : <number>
},
"session" : {
"object compaction" : <number>,
"open cursor count" : <number>
},
"transaction" : {
"update conflicts" : <number>
}
},
"nindexes" : <number>,
"totalIndexSize" : <number>,
"indexSizes" : {
"_id_" : <number>,
"username" : <number>
},
// ...
"ok" : <number>
}
.. _collStats-output:
Output
------
.. data:: collStats.ns
The namespace of the current collection, which follows the format
``[database].[collection]``.
.. data:: collStats.size
The total uncompressed size in memory of all records in a
collection. The :data:`~collStats.size` does not
include the size of any indexes associated with the collection,
which the :data:`~collStats.totalIndexSize` field reports.
For the deprecated MMAPv1 storage engine, :data:`~collStats.size`
includes the record's :term:`padding` but not the record header,
which is 16 bytes per record.
The ``scale`` argument affects :data:`~collStats.size`. Data
compression does not affect this value.
.. data:: collStats.count
The number of objects or documents in this collection.
.. data:: collStats.avgObjSize
The average size of an object in the collection (plus any
:term:`padding` for MMAPv1). The ``scale`` argument does not affect this
value.
.. data:: collStats.storageSize
The total amount of storage allocated to this collection for
:term:`document` storage. The ``scale`` argument affects this
value.
If collection data is compressed (which is the :option:`default for
WiredTiger <mongod --wiredTigerCollectionBlockCompressor>`), the
storage size reflects the compressed size and may be smaller than
the value for :data:`collStats.size`.
:data:`~collStats.storageSize` does not include index size. See
:data:`~collStats.totalIndexSize` for index sizing.
For MMAPv1, :data:`~collStats.storageSize` will not decrease
as you remove or shrink documents.
.. for MMAPv1: sum of all extents (no indexes or the $freelist)
.. data:: collStats.numExtents
The total number of contiguously allocated data file regions.
Only present when using the MMAPv1 storage engine.
.. data:: collStats.nindexes
The number of indexes on the collection. All collections have at
least one index on the :term:`_id` field.
.. data:: collStats.lastExtentSize
The size of the last extent allocated. The ``scale`` argument
affects this value. Only present when using the ``mmapv1`` storage
engine.
.. data:: collStats.paddingFactor
.. deprecated:: 3.0.0
:data:`~collStats.paddingFactor` is no longer used in 3.0.0, and
remains hard coded to 1.0 for compatibility only.
:data:`~collStats.paddingFactor` only appears when using the
``mmapv1`` storage engine.
.. data:: collStats.userFlags
A number that indicates the user-set flags on the collection.
:data:`~collStats.userFlags` only appears when using the ``mmapv1``
storage engine.
.. versionchanged:: 3.0.0
:data:`~collStats.userFlags` reports on the
:collflag:`usePowerOf2Sizes` and the :collflag:`noPadding`
flags.
.. include:: /includes/list-collection-user-flags.rst
.. data:: collStats.totalIndexSize
The total size of all indexes. The ``scale`` argument affects this
value.
If an index uses prefix compression (which is the :option:`default
for WiredTiger <mongod --wiredTigerIndexPrefixCompression>`), the
returned size reflects the compressed size for any such indexes when
calculating the total.
.. data:: collStats.indexSizes
This field specifies the key and size of every existing index on
the collection. The ``scale`` argument affects this value.
If an index uses prefix compression (which is the :option:`default
for WiredTiger <mongod --wiredTigerIndexPrefixCompression>`), the
returned size reflects the compressed size.
.. data:: collStats.capped
This field will be "true" if the collection is
:term:`capped <capped collection>`.
.. data:: collStats.max
Shows the maximum number of documents that may be present in a
:term:`capped collection`.
.. data:: collStats.maxSize
Shows the maximum size of a :term:`capped collection`.
.. data:: collStats.wiredTiger
.. versionadded:: 3.0.0
:data:`~collStats.wiredTiger` only appears when using the
WiredTiger storage engine.
This document contains data reported
directly by the WiredTiger engine and other data for internal
diagnostic use.
.. data:: collStats.indexDetails
.. versionadded:: 3.0.0
A document that reports data from the :ref:`WiredTiger <storage-wiredTiger>`
storage engine for each index in the collection. Other storage engines will
return an empty document.
The fields in this document are the names of the indexes, while the
values themselves are documents that contain statistics for the
index provided by the storage engine. These statistics are for
internal diagnostic use.