mongo索引性能
https://www.cnblogs.com/c-abc/p/6023824.html 测试mongo索引性能 有索引,每个值都是唯一值 "executionStats" : { "executionSuccess" : true, "nReturned" : 1, "executionTimeMillis" : 0, ## 总耗时 "totalKeysExamined" : 1, ## "totalDocsExamined" : 1, ## 检索文档数 "executionStages" : { "stage" : "FETCH", "nReturned" : 1, "executionTimeMillisEstimate" : 0, "works" : 2, "advanced" : 1, "needTime" : 0, "needYield" : 0, "saveState" : 0, "restoreState" : 0, "isEOF" : 1, "invalidates" : 0, "docsExamined" : 1, "alreadyHasObj" : 0, "inputStage" : { "stage" : "IXSCAN", "nReturned" : 1, "executionTimeMillisEstimate" : 0, "works" : 2, "advanced" : 1, "needTime" : 0, "needYield" : 0, "saveState" : 0, "restoreState" : 0, "isEOF" : 1, "invalidates" : 0, "keyPattern" : { "attr" : 1 }, "indexName" : "attr", "isMultiKey" : false, "multiKeyPaths" : { "attr" : [] }, "isUnique" : false, "isSparse" : false, "isPartial" : false, "indexVersion" : 2, "direction" : "forward", "indexBounds" : { "attr" : [ "[\"所属国家\", \"所属国家\"]" ] }, "keysExamined" : 1, "seeks" : 1, "dupsTested" : 0, "dupsDropped" : 0, "seenInvalidated" : 0 } } }, 无索引,每个值都是唯一值 "executionStats" : { "executionSuccess" : true, "nReturned" : 1, "executionTimeMillis" : 6, "totalKeysExamined" : 0, "totalDocsExamined" : 4723, "executionStages" : { "stage" : "COLLSCAN", "filter" : { "attr" : { "$eq" : "所属国家" } }, "nReturned" : 1, "executionTimeMillisEstimate" : 0, "works" : 4725, "advanced" : 1, "needTime" : 4723, "needYield" : 0, "saveState" : 36, "restoreState" : 36, "isEOF" : 1, "invalidates" : 0, "direction" : "forward", "docsExamined" : 4723 } }, 可以看出,有索引后只需要检索一个文档,并且时间由原来的6降低到了0 有索引,只有两个值 "executionStats" : { "executionSuccess" : true, "nReturned" : 4723, "executionTimeMillis" : 13, ## "totalKeysExamined" : 4723, ## 这里有查找索引需要的时间 "totalDocsExamined" : 4723, ## "executionStages" : { "stage" : "FETCH", "nReturned" : 4723, "executionTimeMillisEstimate" : 20, "works" : 4724, "advanced" : 4723, "needTime" : 0, "needYield" : 0, "saveState" : 36, "restoreState" : 36, "isEOF" : 1, "invalidates" : 0, "docsExamined" : 4723, "alreadyHasObj" : 0, "inputStage" : { "stage" : "IXSCAN", "nReturned" : 4723, "executionTimeMillisEstimate" : 20, "works" : 4724, "advanced" : 4723, "needTime" : 0, "needYield" : 0, "saveState" : 36, "restoreState" : 36, "isEOF" : 1, "invalidates" : 0, "keyPattern" : { "domain_has_entity" : 1 }, "indexName" : "ha", "isMultiKey" : false, "multiKeyPaths" : { "domain_has_entity" : [] }, "isUnique" : false, "isSparse" : false, "isPartial" : false, "indexVersion" : 2, "direction" : "forward", "indexBounds" : { "domain_has_entity" : [ "[\"False\", \"False\"]" ] }, "keysExamined" : 4723, "seeks" : 1, "dupsTested" : 0, "dupsDropped" : 0, "seenInvalidated" : 0 } } }, https://www.cnblogs.com
标签(空格分隔): mongo
https://www.cnblogs.com/c-abc/p/6023824.html 测试mongo索引性能 有索引,每个值都是唯一值 "executionStats" : { "executionSuccess" : true, "nReturned" : 1, "executionTimeMillis" : 0, ## 总耗时 "totalKeysExamined" : 1, ## "totalDocsExamined" : 1, ## 检索文档数 "executionStages" : { "stage" : "FETCH", "nReturned" : 1, "executionTimeMillisEstimate" : 0, "works" : 2, "advanced" : 1, "needTime" : 0, "needYield" : 0, "saveState" : 0, "restoreState" : 0, "isEOF" : 1, "invalidates" : 0, "docsExamined" : 1, "alreadyHasObj" : 0, "inputStage" : { "stage" : "IXSCAN", "nReturned" : 1, "executionTimeMillisEstimate" : 0, "works" : 2, "advanced" : 1, "needTime" : 0, "needYield" : 0, "saveState" : 0, "restoreState" : 0, "isEOF" : 1, "invalidates" : 0, "keyPattern" : { "attr" : 1 }, "indexName" : "attr", "isMultiKey" : false, "multiKeyPaths" : { "attr" : [] }, "isUnique" : false, "isSparse" : false, "isPartial" : false, "indexVersion" : 2, "direction" : "forward", "indexBounds" : { "attr" : [ "[\"所属国家\", \"所属国家\"]" ] }, "keysExamined" : 1, "seeks" : 1, "dupsTested" : 0, "dupsDropped" : 0, "seenInvalidated" : 0 } } }, 无索引,每个值都是唯一值 "executionStats" : { "executionSuccess" : true, "nReturned" : 1, "executionTimeMillis" : 6, "totalKeysExamined" : 0, "totalDocsExamined" : 4723, "executionStages" : { "stage" : "COLLSCAN", "filter" : { "attr" : { "$eq" : "所属国家" } }, "nReturned" : 1, "executionTimeMillisEstimate" : 0, "works" : 4725, "advanced" : 1, "needTime" : 4723, "needYield" : 0, "saveState" : 36, "restoreState" : 36, "isEOF" : 1, "invalidates" : 0, "direction" : "forward", "docsExamined" : 4723 } }, 可以看出,有索引后只需要检索一个文档,并且时间由原来的6降低到了0 有索引,只有两个值 "executionStats" : { "executionSuccess" : true, "nReturned" : 4723, "executionTimeMillis" : 13, ## "totalKeysExamined" : 4723, ## 这里有查找索引需要的时间 "totalDocsExamined" : 4723, ## "executionStages" : { "stage" : "FETCH", "nReturned" : 4723, "executionTimeMillisEstimate" : 20, "works" : 4724, "advanced" : 4723, "needTime" : 0, "needYield" : 0, "saveState" : 36, "restoreState" : 36, "isEOF" : 1, "invalidates" : 0, "docsExamined" : 4723, "alreadyHasObj" : 0, "inputStage" : { "stage" : "IXSCAN", "nReturned" : 4723, "executionTimeMillisEstimate" : 20, "works" : 4724, "advanced" : 4723, "needTime" : 0, "needYield" : 0, "saveState" : 36, "restoreState" : 36, "isEOF" : 1, "invalidates" : 0, "keyPattern" : { "domain_has_entity" : 1 }, "indexName" : "ha", "isMultiKey" : false, "multiKeyPaths" : { "domain_has_entity" : [] }, "isUnique" : false, "isSparse" : false, "isPartial" : false, "indexVersion" : 2, "direction" : "forward", "indexBounds" : { "domain_has_entity" : [ "[\"False\", \"False\"]" ] }, "keysExamined" : 4723, "seeks" : 1, "dupsTested" : 0, "dupsDropped" : 0, "seenInvalidated" : 0 } } }, https://www.cnblogs.com