[SERVER-11699] Update command: unexpected performance Created: 14/Nov/13  Updated: 10/Dec/14  Resolved: 21/Dec/13

Status: Closed
Project: Core Server
Component/s: Index Maintenance, Write Ops
Affects Version/s: 2.4.5
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: Raul Diaz Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-8192 Optimize btree key generation Closed
Participants:

 Description   

I have a strange behavior related to the update command. The execution time is quite different if the collection has indexes or not.

I have a document like this:
{
"data1": 1,
"array1": [

{ "a": "1a", "b": "1b" }

,

{ "a": "2a", "b": "2b" }

]
}

If I execute an update like this (to add a field) in 10000 elements collection:
db.collupdate({},{$set:{data2: 1}},

{multi:true}

)

It takes:
nscanned:10011 nmoved:16 nupdated:10000 keyUpdates:0 numYields: 37 locks(micros) w:24836011 16787ms

If I create an index on field "array1.a" and repeat the same test, the result is quite different:
nscanned:10009 nmoved:9 nupdated:10000 keyUpdates:0 numYields: 1384 locks(micros) w:365091225 184838ms

Why the index is affecting so much? I don't understand why if the index is not defined on that field is affecting in the time execution.

Thanks a lot

Raul



 Comments   
Comment by Asya Kamsky [ 21/Dec/13 ]

duplicate of SERVER-8192

Generated at Thu Feb 08 03:26:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.