Dis*_*ana 4 mongodb neo4j nosql
我使用了两个NOSQL数据库MongoDB和Neo4j来处理相同的信息.我想使用第一个和第二个db来比较性能.我在这个问题上谈到了MongoDB 的问题:执行时间millis总是等于0.所以我在我的集合中添加了大约250个文档但没有任何成功:
> db.team.find({common_name:"Milan"},{_id:0, "stadium.name":1}).explain("executionStats")
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "Progettino.team",
"indexFilterSet" : false,
"parsedQuery" : {
"common_name" : {
"$eq" : "Milan"
}
},
"winningPlan" : {
"stage" : "PROJECTION",
"transformBy" : {
"_id" : 0,
"stadium.name" : 1
},
"inputStage" : {
"stage" : "COLLSCAN",
"filter" : {
"common_name" : {
"$eq" : "Milan"
}
},
"direction" : "forward"
}
},
"rejectedPlans" : [ ]
},
"executionStats" : {
"executionSuccess" : true,
"nReturned" : 1,
"executionTimeMillis" : 0,
"totalKeysExamined" : 0,
"totalDocsExamined" : 253,
"executionStages" : {
"stage" : "PROJECTION",
"nReturned" : 1,
"executionTimeMillisEstimate" : 0,
"works" : 255,
"advanced" : 1,
"needTime" : 253,
"needFetch" : 0,
"saveState" : 0,
"restoreState" : 0,
"isEOF" : 1,
"invalidates" : 0,
"transformBy" : {
"_id" : 0,
"stadium.name" : 1
},
"inputStage" : {
"stage" : "COLLSCAN",
"filter" : {
"common_name" : {
"$eq" : "Milan"
}
},
"nReturned" : 1,
"executionTimeMillisEstimate" : 0,
"works" : 255,
"advanced" : 1,
"needTime" : 253,
"needFetch" : 0,
"saveState" : 0,
"restoreState" : 0,
"isEOF" : 1,
"invalidates" : 0,
"direction" : "forward",
"docsExamined" : 255
}
}
}
Run Code Online (Sandbox Code Playgroud)
例如在MongoDB中,这个查询比Neo4j更好,因为我使用非规范化模型来表示团队体育场的信息.事实上,在Neo4j中,这个查询需要50毫秒,你可以看到:

那么,我该怎么做才能获得MongoDB中执行时间毫秒的信息?我有一些问题,如果执行时间米利斯总是等于0,因为我不能显示在与两个不同的NoSQL数据库相同的查询不同的表现.
正如你回答的另一个问题所述.你的收藏太小了.这是我从一个超过3K项目的数据库输出.注意我的executionTimeInMillis只有2毫秒.你需要更多的数据来让mongo真正流失.根据机器的大小,可以说10K以上的记录.
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "arenas.arenas",
"indexFilterSet" : false,
"parsedQuery" : {
"$and" : []
},
"winningPlan" : {
"stage" : "COLLSCAN",
"filter" : {
"$and" : []
},
"direction" : "forward"
},
"rejectedPlans" : []
},
"executionStats" : {
"executionSuccess" : true,
"nReturned" : 3718,
"executionTimeMillis" : 2,
"totalKeysExamined" : 0,
"totalDocsExamined" : 3718,
"executionStages" : {
"stage" : "COLLSCAN",
"filter" : {
"$and" : []
},
"nReturned" : 3718,
"executionTimeMillisEstimate" : 0,
"works" : 3724,
"advanced" : 3718,
"needTime" : 1,
"needFetch" : 4,
"saveState" : 31,
"restoreState" : 31,
"isEOF" : 1,
"invalidates" : 0,
"direction" : "forward",
"docsExamined" : 3718
},
"allPlansExecution" : []
}
Run Code Online (Sandbox Code Playgroud)
}