Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat does the nscannedObjectsAllPlans in MongoDb explain mean
    primarykey
    data
    text
    <p>Im trying to examine a query and Im not sure what "nscannedObjectsAllPlans" and "nscannedAllPlans" is doing because I see that if I run a query directly off an indexed field "purchaseState"</p> <p>I get the same results scanned items for "<strong>nscannedObjects</strong>", "<strong>nscanned</strong>", "<strong>nscannedObjectsAllPlans</strong>", and "<strong>nscannedAllPlans</strong>"</p> <p>However once I added price greater than 400 into the query the <strong>nscannedObjectsAllPlans</strong> is now greater than the <strong>nscannedObjects</strong> I wanted to know if <strong>nscannedObjectsAllPlans</strong> is the total number of scanned objects that running a plan with the purchase_state index along with the purchase_state_Id index? or is it just stating the Greater of the two index plan results??</p> <p>I added an index to pruchase state then I added an index on purchase state and Id</p> <p>db.toys.ensureIndex({"purchaseState" : 1})</p> <p>db.toys.ensureIndex({"purchaseState" : 1, "_id" : 1})</p> <pre><code> **db.toys.find({"purchaseState" : "NY"}).pretty().explain()** "cursor" : "BtreeCursor purchaseState_1", "isMultiKey" : false, "n" : 1596, "nscannedObjects" : 1596, "nscanned" : 1596, "nscannedObjectsAllPlans" : 1596, "nscannedAllPlans" : 1596, "scanAndOrder" : false, "indexOnly" : false, "nYields" : 0, "nChunkSkips" : 0, "millis" : 3, "indexBounds" : { "purchaseState" : [ [ "NY", "NY" ] ] }, "server" : "XXXXXXX:27017" **db.toys.find({"purchaseState" : "NY", "price": { $gt : 400 }}).pretty().explain()** "cursor" : "BtreeCursor purchaseState_1", "isMultiKey" : false, "n" : 1423, "nscannedObjects" : 1596, "nscanned" : 1596, "nscannedObjectsAllPlans" : 1808, "nscannedAllPlans" : 1808, "scanAndOrder" : false, "indexOnly" : false, "nYields" : 0, "nChunkSkips" : 0, "millis" : 10, "indexBounds" : { "purchaseState" : [ [ "NY", "NY" ] ] }, "server" : "XXXXXXX:27017" </code></pre>
    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. 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