hi have you try insert the record in 1 call like batch/bulk insert. i don't know if mongo can do this.
Sent from my iPhone On 10 Jan 2013, at 16:16, Raju Bishnoi <rajubishno...@gmail.com> wrote: > Hi, > > I run the below php code with Mongo & MongoClient to insert 100k records. > Mongo took 70-75 second to complete and MongoClient took 440-450 second. > > $start = microtime(true); > > $objBaseMongoRecord = new BaseMongoRecord(); > > $objBaseMongoRecord-> > setCollectionName("mongotest"); > > $i = 0; > while ($i < 1000000) { > > $data = array( > "name" => array( > "firstname" => "raju" . $i, > "lastname" => "bishnoi" . $i), > "address" => array( > "street" => "raju" . $i, > "city" => "city" . $i, > "state" => "state" . $i, > "country" => "country" . $i, > "zipcode" => "1" . $i), > "officephone" => "25412541", > "homephone" => "625412541", > "status" => "A", > "date" => date('Y-m-d:H-i-s'), > "time" => time()); > > $objBaseMongoRecord->ensureIndex(array("time" => 1)); > $objBaseMongoRecord->insert($data); > $i++; > } > > $duration = microtime(true) - $start; > // print in the format 1.2345 for better reading > printf("took %0.4d seconds", $duration); > > Can anyone tell me why MongoClient tooks more time and how to make it fast. > > Thanks > Raju > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to cake-php@googlegroups.com. > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.