给出以下查询:
Warning: file_get_contents(https://xxxxx.xxx.com/2/delivery/request?api_key=23894thfpoiq10fapo93fmapo&user_id=5744125&deliveery_type=Programado&route=E.+Pallares+y&street_number=110&neighborhood=San Lucas&locality=Distrito+Federal&administrative_area_level_1=Distrito+Federal&postal_code=04030&country=Mexico&latlng=19.346%2C-99.154&destination-route=Pallares+y+Portillo+181+Casa+5%2CParque+San&destination-street_number=&destination-neighborhood=&destination-locality=Coyoacan&destination-administrative_area_level=Distrito+Federal&destination-postal_code=04030&destination-country=Mexico&destination-latlng=19.365%2C-99.1966&customer_email=saul%4099minutos.com&customer_phone=5554&notification_email=&notes=Orden%3A+%231019%2C+Cliente%3A+Ricardo+Torreblanca%2C+Productos%3A+Paquete+Blackmore+ONE+%5Bincluye+1+cafetera+en+comodato+%2B+60+c%C3%A1psulas+mensuales%2C+durante+12+mes in
/home/public_html/shopify/shipping_test.php on line 1301
产生以下输出:
var exp = db.messages.explain('executionStats')
exp.find( { 'headers.Date' : { '$gt' : new Date(2001,3,1) } }, { 'headers.From' : 1, '_id' : 0 } ).sort( { 'headers.From' : 1 } )
解释中的内容是说查询没有使用索引?根据我的理解,以下部分暗示使用了一个索引,因为获胜计划中有一个{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "enron.messages",
"indexFilterSet" : false,
"parsedQuery" : {
"headers.Date" : {
"$gt" : ISODate("2001-04-01T05:00:00Z")
}
},
"winningPlan" : {
"stage" : "PROJECTION",
"transformBy" : {
"headers.From" : 1,
"_id" : 0
},
"inputStage" : {
"stage" : "FETCH",
"filter" : {
"headers.Date" : {
"$gt" : ISODate("2001-04-01T05:00:00Z")
}
},
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"headers.From" : 1
},
"indexName" : "headers.From_1",
"isMultiKey" : false,
"direction" : "forward",
"indexBounds" : {
"headers.From" : [
"[MinKey, MaxKey]"
]
}
}
}
},
"rejectedPlans" : [ ]
},
"executionStats" : {
"executionSuccess" : true,
"nReturned" : 83057,
"executionTimeMillis" : 726,
"totalKeysExamined" : 120477,
"totalDocsExamined" : 120477,
"executionStages" : {
"stage" : "PROJECTION",
"nReturned" : 83057,
"executionTimeMillisEstimate" : 690,
"works" : 120478,
"advanced" : 83057,
"needTime" : 37420,
"needFetch" : 0,
"saveState" : 941,
"restoreState" : 941,
"isEOF" : 1,
"invalidates" : 0,
"transformBy" : {
"headers.From" : 1,
"_id" : 0
},
"inputStage" : {
"stage" : "FETCH",
"filter" : {
"headers.Date" : {
"$gt" : ISODate("2001-04-01T05:00:00Z")
}
},
"nReturned" : 83057,
"executionTimeMillisEstimate" : 350,
"works" : 120478,
"advanced" : 83057,
"needTime" : 37420,
"needFetch" : 0,
"saveState" : 941,
"restoreState" : 941,
"isEOF" : 1,
"invalidates" : 0,
"docsExamined" : 120477,
"alreadyHasObj" : 0,
"inputStage" : {
"stage" : "IXSCAN",
"nReturned" : 120477,
"executionTimeMillisEstimate" : 60,
"works" : 120477,
"advanced" : 120477,
"needTime" : 0,
"needFetch" : 0,
"saveState" : 941,
"restoreState" : 941,
"isEOF" : 1,
"invalidates" : 0,
"keyPattern" : {
"headers.From" : 1
},
"indexName" : "headers.From_1",
"isMultiKey" : false,
"direction" : "forward",
"indexBounds" : {
"headers.From" : [
"[MinKey, MaxKey]"
]
},
"keysExamined" : 120477,
"dupsTested" : 0,
"dupsDropped" : 0,
"seenInvalidated" : 0,
"matchTested" : 0
}
}
}
},
"serverInfo" : {
"host" : "dpercy-mac-air.local",
"port" : 27017,
"version" : "3.0.1",
"gitVersion" : "534b5a3f9d10f00cd27737fbcd951032248b5952"
},
"ok" : 1
}
阶段:
IXSCAN
但是我被告知这个查询没有使用索引。那是为什么?