Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-1316

single object update, by _id, seems slow

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • 1.9.0
    • None
    • Performance
    • None

    Description

      see test code below. 11 sec for multi update vs. 70sec from the shell on localhost. that seems like an awfully big difference to me. surely can be better for the iterative case?

      -----------------------

      x =

      { classname: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }

      ;

      t = db.foo;
      t.drop();

      start = new Date();

      for( var i = 0; i < 500000; i++ )
      t.insert;
      print( tojson( db.getLastError() ) );

      print("insert done");
      print(new Date() - start);
      // e.g., 29secs

      print(t.count());

      start = new Date();

      // multi update version
      t.update(

      { classname: x.classname }

      , { $set:

      { classname: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbb"}

      }, false, true);
      // e.g., 11sec

      /* manual iteration version
      t.find(

      {'classname':x.classname}

      ).forEach(
      function(u)
      // faster:
      //

      { u.classname="com.abcdefghijkl"; t.save(u); }


      // e.g., 56secs

      // slower:

      { u.classname="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbb"; t.save(u); }

      // e.g., 70sec
      );
      */
      print( tojson( db.getLastError() ) );

      print("modifications done");
      print( new Date() - start );

      print(t.count());

      Attachments

        Activity

          People

            eliot Eliot Horowitz (Inactive)
            dwight@mongodb.com Dwight Merriman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: