diff --git a/source/reference/command/validate.txt b/source/reference/command/validate.txt index cdd3dba2de0..71c88115c86 100644 --- a/source/reference/command/validate.txt +++ b/source/reference/command/validate.txt @@ -28,6 +28,10 @@ Definition The :dbcommand:`validate` command does not support :doc:`views ` and raises an error when run against a view. + The :method:`db.collection.validate()` method in + :binary:`~bin.mongosh` provides a wrapper around + :dbcommand:`validate`. + Syntax ------ @@ -96,6 +100,9 @@ The command takes the following fields: Behavior -------- +Performance +~~~~~~~~~~~ + The :dbcommand:`validate` command can be slow, particularly on larger data sets. @@ -105,6 +112,17 @@ until the operation finishes. When run on a secondary, the :dbcommand:`validate` operation can block all other operations on that secondary until it finishes. +.. warning:: + + Due to the performance impact of validation, consider running + :dbcommand:`validate` only on :term:`secondary` replica set nodes. + You can use :method:`rs.stepDown()` to instruct the current + :term:`primary` node to become a secondary to avoid impacting a live + primary node. + +Data Throughput Metrics +~~~~~~~~~~~~~~~~~~~~~~~ + .. include:: /includes/extracts/4.4-validate-data-throughput.rst Restrictions diff --git a/source/reference/method/db.collection.validate.txt b/source/reference/method/db.collection.validate.txt index c96f46f42f4..d5dad529833 100644 --- a/source/reference/method/db.collection.validate.txt +++ b/source/reference/method/db.collection.validate.txt @@ -97,8 +97,12 @@ following optional document parameter with the fields: Behavior -------- +Performance +~~~~~~~~~~~ + The :method:`db.collection.validate()` method is potentially resource -intensive and may impact the performance of your MongoDB instance. +intensive and may impact the performance of your MongoDB instance, +particularly on larger data sets. The :method:`db.collection.validate()` method obtains an exclusive lock on the collection. This will block all reads and writes on the @@ -106,8 +110,16 @@ collection until the operation finishes. When run on a secondary, the operation can block all other operations on that secondary until it finishes. -The :method:`db.collection.validate()` method can be slow, particularly -on larger data sets. +.. warning:: + + Due to the performance impact of validation, consider running + :method:`db.collection.validate()` only on :term:`secondary` replica + set nodes. You can use :method:`rs.stepDown()` to instruct the + current :term:`primary` node to become a secondary to avoid + impacting a live primary node. + +Data Throughput Metrics +~~~~~~~~~~~~~~~~~~~~~~~ .. include:: /includes/extracts/4.4-validate-data-throughput.rst