python - When argument set 'safe=True' performances drop mongodb -


i have following code:

dbh.postings.update({"word" : word},{"$pushall":{"postings":self.postings[word]}}, safe=true, upsert=true)   

comparison of performances:

insert/update on 3060 rows (word -> postings)

  • with 'safe' set on true: 3.7s
  • without 'safe' set on true: 0.4s

how possible? why operations parameter 'safe' set slow?

structure:

{ "_id" : objectid("520d08f5c9aaeee8311e2e7c"), "postings" : [ [ 12, 1 ], [ 14, 1 ] ], "word" : "95" } 

updates made on: "postings" : [ [ 12, 1 ], [ 14, 1 ] ] field of [ 14, 1 ] pair added $pushall

yeah, that's expected.

safe off means acknowledges operation socket however, safe on relatively same thing sql techs , make sure operation went mongodb etc.

however, update taking long, cannot tell without more information. example indexes, document structure , arguments sending update statement.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -