Reputation: 23
I'm concerning with the performance,
say when I do db.xx.update({a:1}, {c:2})
, will mongodb take extra time to update the index on {a:1, b:1}
?
is there a way to profile the update operation?
Upvotes: 0
Views: 65
Reputation: 42352
If you change the value of a or b during the update then the index will be updated. If you don't change either of the values, the index will only be updated if the document had to be relocated on disk during the update process.
The way to tell for sure is to profile your updates - they are logged in mongod
log if they take longer than 100ms but you can start mongod
with a lower threshold (using --slowms
switch) or you can turn on profiling for the DB in question with level 2 and then all operations will be logged into the system.profile
collection.
Read more about it here: http://docs.mongodb.org/manual/reference/command/profile/
Upvotes: 2