Skip to content

Commit 22e1172

Browse files
(DOCS-13376): Add performance warnings for validation
1 parent e5a5444 commit 22e1172

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed

source/reference/command/validate.txt

+18
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ Definition
2828
The :dbcommand:`validate` command does not support :doc:`views
2929
</core/views>` and raises an error when run against a view.
3030

31+
The :method:`db.collection.validate()` method in
32+
:binary:`~bin.mongosh` provides a wrapper around
33+
:dbcommand:`validate`.
34+
3135
Syntax
3236
------
3337

@@ -96,6 +100,9 @@ The command takes the following fields:
96100
Behavior
97101
--------
98102

103+
Performance
104+
~~~~~~~~~~~
105+
99106
The :dbcommand:`validate` command can be slow, particularly on
100107
larger data sets.
101108

@@ -105,6 +112,17 @@ until the operation finishes. When run on a secondary, the
105112
:dbcommand:`validate` operation can block all other operations on that
106113
secondary until it finishes.
107114

115+
.. warning::
116+
117+
Due to the performance impact of validation, consider running
118+
:dbcommand:`validate` only on :term:`secondary` replica set nodes.
119+
You can use :method:`rs.stepDown()` to instruct the current
120+
:term:`primary` node to become a secondary to avoid impacting a live
121+
primary node.
122+
123+
Data Throughput Metrics
124+
~~~~~~~~~~~~~~~~~~~~~~~
125+
108126
.. include:: /includes/extracts/4.4-validate-data-throughput.rst
109127

110128
Restrictions

source/reference/method/db.collection.validate.txt

+15-3
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,29 @@ following optional document parameter with the fields:
9797
Behavior
9898
--------
9999

100+
Performance
101+
~~~~~~~~~~~
102+
100103
The :method:`db.collection.validate()` method is potentially resource
101-
intensive and may impact the performance of your MongoDB instance.
104+
intensive and may impact the performance of your MongoDB instance,
105+
particularly on larger data sets.
102106

103107
The :method:`db.collection.validate()` method obtains an exclusive lock
104108
on the collection. This will block all reads and writes on the
105109
collection until the operation finishes. When run on a secondary, the
106110
operation can block all other operations on that secondary until it
107111
finishes.
108112

109-
The :method:`db.collection.validate()` method can be slow, particularly
110-
on larger data sets.
113+
.. warning::
114+
115+
Due to the performance impact of validation, consider running
116+
:method:`db.collection.validate()` only on :term:`secondary` replica
117+
set nodes. You can use :method:`rs.stepDown()` to instruct the
118+
current :term:`primary` node to become a secondary to avoid
119+
impacting a live primary node.
120+
121+
Data Throughput Metrics
122+
~~~~~~~~~~~~~~~~~~~~~~~
111123

112124
.. include:: /includes/extracts/4.4-validate-data-throughput.rst
113125

0 commit comments

Comments
 (0)