-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathdb.collection.configureQueryAnalyzer.txt
122 lines (85 loc) · 2.64 KB
/
db.collection.configureQueryAnalyzer.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
.. _configureQueryAnalyzer-method:
======================================
db.collection.configureQueryAnalyzer()
======================================
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. method:: db.collection.configureQueryAnalyzer(options)
Configures query sampling for a collection on a replica set or
sharded cluster. Sampled queries provide information to
:dbcommand:`analyzeShardKey` to calculate metrics about read and
write distribution of a shard key.
The :method:`db.collection.configureQueryAnalyzer()` method wraps the
:dbcommand:`configureQueryAnalyzer` command.
:returns:
A document containing fields describing the old configuration, if
one exists, and fields describing the new configuration. For
details, see :ref:`<cqa-output>`.
Compatibility
-------------
.. |command| replace:: method
This method is available in deployments hosted in the following environments:
.. include:: /includes/fact-environments-atlas-only.rst
.. include:: /includes/fact-environments-atlas-support-no-free.rst
.. include:: /includes/fact-environments-onprem-only.rst
Syntax
------
The method has the following syntax:
.. code-block:: javascript
db.collection.configureQueryAnalyzer(
{
mode: <string>,
samplesPerSecond: <double>
}
)
Fields
~~~~~~
.. |CQA| replace:: ``db.collection.configureQueryAnalyzer()``
|CQA| has the following fields:
.. list-table::
:header-rows: 1
:widths: 10 10 10 70
* - Field
- Type
- Necessity
- Description
* - ``mode``
- string
- Required
- Mode the query analyzer runs in. Must be set to either
``"full"`` or ``"off"``.
* - ``samplesPerSecond``
- double
- Optional
- Number of samples per second.
- When ``mode`` is set to ``"full"``, ``samplesPerSecond`` must
be set between ``0`` and ``50``.
- When ``mode`` is set to ``"off"``, the server ignores
``samplesPerSecond``.
For details, see :ref:`samplesPerSeconds Upper Limit
<samplesPerSecond-limit>`.
Access Control
--------------
For details, see :ref:`configureQueryAnalyzer Access Control
<cqa-access-control>`.
Behavior
--------
For behavior, see :ref:`configureQueryAnalyzer Behavior
<cqa-behavior>`.
Output
------
For details, see :ref:`configureQueryAnalyzer Output <cqa-output>`.
Examples
--------
For examples, see :ref:`configureQueryAnalyzer Examples
<cqa-examples>`.
Learn More
----------
- :dbcommand:`analyzeShardKey`
- :dbcommand:`configureQueryAnalyzer`
- :pipeline:`$listSampledQueries`