Reputation: 77
I have an update operation running on my collection, and it involves updating several million rows of data. I would like to monitor the progress of this operation, and have turned to the current operations view.
The numYields value appears to increment in line with what the DB should be doing, so I wonder whether it increments each time a document is modified (update:Multi).
According to the documentation:
Long running read and write operations, such as queries, updates, and deletes, yield under many conditions. MongoDB operations can also yield locks between individual document modifications in write operations that affect multiple documents like update() with the multi parameter.
However, the paragraph above does not specify whether each and every update on the document yields, or whether it happens occasionally once in a few updates.
Could someone share the light on whether this indicator is reliable for determining how many documents were updated as a part of this long-running operation?
Upvotes: 1
Views: 900
Reputation: 65363
Could someone share the light on whether this indicator is reliable for determining how many documents were updated as a part of this long-running operation?
No: numYields
only indicates that a long running operation yielded. There is no direct correlation with concurrent updates and there are several reasons for periodic yielding as noted in Does a read or write operation ever yield the lock?:
However, the paragraph above does not specify whether each and every update on the document yields, or whether it happens occasionally once in a few updates.
Yielding is periodic, and generally governed by metrics such as elapsed time or a number of operations/iterations.
Upvotes: 2