Note that there are some explanatory texts on larger screens.

plurals
  1. POmongodb stores large size documents and query is very slow
    primarykey
    data
    text
    <p>I store a very long string to my document in mongodb server, my document looks like </p> <pre><code>{ "_id": ObjectId("5280efdbe4b062c93b582118"), "viewID": 1, "content": "a very long string" } </code></pre> <p>and there are about hundreds of such documents in the same collection. I have indexed the collection. </p> <p>The problem is that I just execute a very simple query </p> <pre><code>db.blog.find({viewID:1}); </code></pre> <p>and then get a very long time (over several hours) to wait for the response, and no any error message displayed, server status is OK. But I just add <code>db.blog.find({viewID:1}).limit(1);</code> mongodb returns the result at once. </p> <p>How can I do to solve the problem or improve the performance??</p> <p>Here is my explain:</p> <pre><code>db.blog.find({viewID:1}).explain(); { "cursor" : "BtreeCursor viewID_1", "isMultiKey" : false, "n" : 377, "nscannedObjects" : 377, "nscanned" : 377, "nscannedObjectsAllPlans" : 377, "nscannedAllPlans" : 377, "scanAndOrder" : false, "indexOnly" : false, "nYields" : 0, "nChunkSkips" : 0, "millis" : 45, "indexBounds" : { "viewID" : [ [ 1, 1 ] ] }, "server" : "Server:27017" } </code></pre> <p>Here is colStat:</p> <pre><code>db.blog.stats(); { "ns" : "***.blog", "count" : 98582, "size" : 2330759632, "avgObjSize" : 23642.851960804204, "storageSize" : 2958364672, "numExtents" : 18, "nindexes" : 2, "lastExtentSize" : 778276864, "paddingFactor" : 1, "systemFlags" : 1, "userFlags" : 0, "totalIndexSize" : 6540800, "indexSizes" : { "_id_" : 4055296, "viewID_1" : 2485504 }, "ok" : 1 } </code></pre>
    singulars
    1. This table or related slice is empty.
    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. 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