-
Type: Question
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.4.5
-
Component/s: Index Maintenance, Write Ops
-
None
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": "2a", "b": "2b" } ]
}
If I execute an update like this (to add a field) in 10000 elements collection:
db.collupdate({},{$set:{data2: 1}},
)
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
- duplicates
-
SERVER-8192 Optimize btree key generation
- Closed