Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>it's probably best to do this in the shell, conciously!, because you could cause havoc if you accidentally start such a command at the wrong moment and on the wrong instance.</p> <p>Most importantly: <strong>do this offline on an extra slave instance</strong> if you add an index on an existing DB! For large data sets, building an index can take hours, even days!</p> <p>see also:</p> <p><a href="http://www.mongodb.org/display/DOCS/Indexes" rel="nofollow">http://www.mongodb.org/display/DOCS/Indexes</a></p> <p><a href="http://www.javabeat.net/articles/print.php?article_id=353" rel="nofollow">http://www.javabeat.net/articles/print.php?article_id=353</a></p> <p><a href="http://www.mongodb.org/display/DOCS/Indexing+as+a+Background+Operation" rel="nofollow">http://www.mongodb.org/display/DOCS/Indexing+as+a+Background+Operation</a></p> <p><a href="http://nosql.mypopescu.com/post/1312926692/mongodb-indexes-and-indexing" rel="nofollow">http://nosql.mypopescu.com/post/1312926692/mongodb-indexes-and-indexing</a></p> <p>If you have a large data set, make sure to read up on the <strong>4square outage</strong> last year..!!</p> <p><a href="http://www.infoq.com/news/2010/10/4square_mongodb_outage" rel="nofollow">http://www.infoq.com/news/2010/10/4square_mongodb_outage</a></p> <p><a href="http://blog.foursquare.com/2010/10/05/so-that-was-a-bummer/" rel="nofollow">http://blog.foursquare.com/2010/10/05/so-that-was-a-bummer/</a></p> <p><a href="http://highscalability.com/blog/2010/10/15/troubles-with-sharding-what-can-we-learn-from-the-foursquare.html" rel="nofollow">http://highscalability.com/blog/2010/10/15/troubles-with-sharding-what-can-we-learn-from-the-foursquare.html</a></p> <hr> <p>one of the main reasons for not wanting to put indexing in a script or config file of some sort is that in MongoDB the index operation is blocking(!) -- that means MongoDB will stop other operations on the database from proceeding until the indexing is completed. Just imagine an innocent change in the code, requiring a new index to improve performance -- and this change is carelessly checked-in and deployed to production ... and suddenly your production MongoDB is feezing up for your app-server, because MongoDB is internally adding the new index <strong>first</strong> before doing anything else... outch! Apparently that has happened to a couple of folks, that's why they keep reminding people at the MongoDB conferences to be careful to not 'programmatically' require indexes.</p> <p>New versions of MongoDB allow background indexing -- you should always do that e.g. db.yourcollection.ensureIndex(..., {background: true})</p> <p>otherwise, not-so-fun stuff happens:</p> <p><a href="https://jira.mongodb.org/browse/SERVER-1341" rel="nofollow">https://jira.mongodb.org/browse/SERVER-1341</a></p> <p><a href="https://jira.mongodb.org/browse/SERVER-3067" rel="nofollow">https://jira.mongodb.org/browse/SERVER-3067</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload