我进行了一些性能测试,以了解从以下 dbobject 中获取数据的最有效方法是什么(参见下面的结构)
这是我得到的结果: findOne(无投影) - 8 毫秒
找到一个(通过投影获得元字段) - 56 毫秒
findone(通过投影仅获取描述字段)- 1 毫秒
为什么只用元字段获取同一个对象需要更多时间?我不明白。 并且因为我在 _id 字段上收集了带有索引的会话,并且我的查询包含 id 字段,为什么投影会影响性能?作为它的一个对象,而不是获取所有对象,我想获取特定字段。
"_id" : ObjectId("605107f63079d85300063b3f"),
"description" : "correct",
"networkPolicy" : {
"delay" : NumberInt(15),
"retries" : NumberInt(8)
},
"stopCondition" : "IDLE_DURATION",
"stopConditionDuration" : NumberInt(30),
"transformerConfiguration" : {
"name" : "MULTI AUTO TRANSFORMERCONFIGURATION",
"version" : NumberInt(1),
"description" : "The auto multi transformerconfiguration",
"transformerSpecs" : [
{
"streamType" : "RWR",
"transformerRef" : {
"name" : "com.aaaa.xplorer.plugin.impl.transformer.rwr.RWRCSVTransformer",
"lang" : "JAVA",
"version" : NumberInt(1)
},
"streamName" : "rwr"
}
]
},
"filterDelay" : NumberInt(0),
"viewConfiguration" : {
"name" : "MULTI AUTO VIEWCONFIGURATION",
"version" : NumberInt(1),
"description" : "The auto multi viewconfiguration",
"viewSpecs" : [
{
"streamType" : "RWR",
"type" : "STRING_TO",
"visible" : true,
"contextType" : "BASE",
"presenter" : {
},
"seriesSpecs" : [
{
"seriesName" : "fileIndex",
"visible" : false,
"sortable" : false,
"color" : "N/A",
"hex" : false
},
{
"seriesName" : "index",
"visible" : false,
"sortable" : false,
"color" : "N/A",
"hex" : false
},
{
"seriesName" : "dwords",
"visible" : false,
"sortable" : false,
"color" : "N/A",
"hex" : false
},
{
"seriesName" : "episode",
"visible" : true,
"sortable" : false,
"color" : "N/A",
"hex" : false
},
{
"seriesName" : "timestamp",
"visible" : true,
"sortable" : false,
"color" : "N/A",
"hex" : false
},
{
"seriesName" : "source",
"visible" : true,
"sortable" : false,
"color" : "N/A",
"hex" : false
},
{
"seriesName" : "type",
"visible" : true,
"sortable" : false,
"color" : "N/A",
"hex" : false
},
{
"seriesName" : "id",
"visible" : true,
"sortable" : false,
"color" : "N/A",
"hex" : false
},
{
"seriesName" : "name",
"visible" : true,
"sortable" : false,
"color" : "N/A",
"hex" : false
},
{
"seriesName" : "core",
"visible" : false,
"sortable" : false,
"color" : "N/A",
"hex" : false
},
{
"seriesName" : "parameters",
"visible" : true,
"sortable" : false,
"color" : "N/A",
"hex" : false
},
{
"seriesName" : "globalTimestamp",
"visible" : false,
"sortable" : false,
"color" : "N/A",
"hex" : false
},
{
"seriesName" : "linkedIndex",
"visible" : true,
"sortable" : false,
"color" : "N/A",
"hex" : false
},
{
"seriesName" : "processDuration",
"visible" : false,
"sortable" : false,
"color" : "N/A",
"hex" : false
},
{
"seriesName" : "threadId",
"visible" : true,
"sortable" : false,
"color" : "N/A",
"hex" : false
},
{
"seriesName" : "subSource",
"visible" : true,
"sortable" : false,
"color" : "N/A",
"hex" : false
},
{
"seriesName" : "timestamp48",
"visible" : false,
"sortable" : false,
"color" : "N/A",
"hex" : true
}
],
"name" : "rwr"
},
{
"name" : "evaSummary_rwr",
"type" : "STRING_TO",
"visible" : true,
"contextType" : "ANALYSIS",
"seriesSpecs" : [
{
"analysisType" : "EVA",
"analysisName" : "eva_rwr",
"seriesName" : "evaCheckerName",
"visible" : true,
"sortable" : false
},
{
"analysisType" : "EVA",
"analysisName" : "eva_rwr",
"seriesName" : "evaCheckerPassCount",
"visible" : true,
"sortable" : false
},
{
"analysisType" : "EVA",
"analysisName" : "eva_rwr",
"seriesName" : "evaCheckerTotalCount",
"visible" : true,
"sortable" : false
},
{
"analysisType" : "EVA",
"analysisName" : "eva_rwr",
"seriesName" : "evaCheckerFailCount",
"visible" : true,
"sortable" : false
},
{
"analysisType" : "EVA",
"analysisName" : "eva_rwr",
"seriesName" : "evaCheckerPassRate",
"visible" : true,
"sortable" : false
},
{
"analysisType" : "EVA",
"analysisName" : "eva_rwr",
"seriesName" : "evaCheckerSeverity",
"visible" : true,
"sortable" : false
},
{
"analysisType" : "EVA",
"analysisName" : "eva_rwr",
"seriesName" : "evaCheckerDescription",
"visible" : true,
"sortable" : false
},
{
"analysisType" : "EVA",
"analysisName" : "eva_rwr",
"seriesName" : "evaCheckerFailRows",
"visible" : true,
"sortable" : false,
"baseFieldTarget" : "index",
"viewFieldSource" : "Fail Row IDs"
}
]
}
]
},
"overridden" : false,
"wizard" : true,
"collectors" : [
{
"type" : "SYSTEM",
"name" : "cmd",
"version" : NumberInt(1),
"content" : "cmd /c"
}
],
"analyserConfiguration" : {
"name" : "MULTI AUTO ANALYSERCONFIGURATION",
"version" : NumberInt(1),
"description" : "The auto multi analyserconfiguration",
"analyserSpecs" : [
{
"streamType" : "RWR",
"analysisType" : "EVA",
"streamName" : "rwr",
"analysisName" : "eva_rwr",
"analyserRef" : {
"name" : "com.eva.xplorer.EagleAnalyser",
"lang" : "JAVA",
"version" : NumberInt(1)
},
"properties" : [
{
"name" : "project",
"value" : "eagle"
}
]
}
]
},
"transformers" : [
{
"name" : "com.sandisk.xplorer.plugin.impl.transformer.rwr.RWRCSVTransformer",
"lang" : "JAVA",
"version" : NumberInt(1),
"automaticDependencies" : true,
"classpathOverride" : true,
"content" : "N/A"
}
],
"analysers" : [
{
"name" : "com.eva.xplorer.EagleAnalyser",
"lang" : "JAVA",
"version" : NumberInt(1),
"automaticDependencies" : true,
"classpathOverride" : true,
"options" : [
{
"product" : "Sunbird",
"projects" : [
{
"name" : "Sunbird",
"properties" : [
{
"name" : "project",
"value" : "sunbird"
}
]
},
{
"name" : "Sunbird Samsung",
"properties" : [
{
"name" : "project",
"value" : "sunbird_smsg"
}
]
}
]
},
{
"product" : "Eagle",
"projects" : [
{
"name" : "Eagle",
"properties" : [
{
"name" : "project",
"value" : "eagle"
}
]
},
{
"name" : "Eagle Embedded",
"properties" : [
{
"name" : "project",
"value" : "eagle_emb"
}
]
}
]
},
{
"product" : "Macaw",
"projects" : [
{
"name" : "Macaw",
"properties" : [
{
"name" : "project",
"value" : "macaw"
},
{
"name" : "runScript",
"value" : "checkers/fa_red_flags_emmc.eva"
}
]
},
{
"name" : "Macaw Embedded",
"properties" : [
{
"name" : "project",
"value" : "macaw_emb"
},
{
"name" : "runScript",
"value" : "checkers/fa_red_flags_emmc.eva"
}
]
}
]
},
{
"product" : "Swift",
"projects" : [
{
"name" : "Swift",
"properties" : [
{
"name" : "project",
"value" : "swift"
}
]
}
]
},
{
"product" : "SwiftPro",
"projects" : [
{
"name" : "SwiftPro",
"properties" : [
{
"name" : "project",
"value" : "swiftpro"
}
]
}
]
}
]
}
],
"storageRef" : {
"osType" : "WINDOWS",
"databaseType" : "MONGO",
"version" : "3.6.6",
"remoteRef" : {
"address" : "127.0.0.1",
"port" : NumberInt(27017)
}
},
"_instance" : NumberLong(28),
"_segment" : NumberLong(1),
"_save" : ISODate("2021-03-16T19:33:10.932+0000"),
"_update" : ISODate("2021-03-16T19:34:12.007+0000"),
"initTimestamp" : ISODate("2021-03-16T19:33:13.977+0000"),
"startTimestamp" : ISODate("2021-03-16T19:33:22.913+0000"),
"meta" : {
"sessionStatuses" : [
{
"timestamp" : ISODate("2021-03-16T19:34:10.242+0000"),
"sessionState" : "TERMINATED",
"idleDuration" : NumberLong(26520172900),
"bufferStatus" : {
"capacity" : NumberLong(134217728),
"capacityUsed" : NumberLong(0),
"capacityMaxUsed" : NumberLong(5566670),
"capacityPushed" : NumberLong(6436548),
"capacityPulled" : NumberLong(6436548),
"elementCount" : NumberLong(0),
"elementMaxCount" : NumberLong(1274)
},
"streamStatuses" : [
{
"name" : "rwr",
"collectorState" : "COMPLETED",
"initErrorCount" : NumberLong(0),
"executeErrorCount" : NumberLong(0),
"finalizeErrorCount" : NumberLong(0),
"terminateErrorCount" : NumberLong(0),
"pushCount" : NumberLong(1511),
"pullCount" : NumberLong(1511),
"overrideCount" : NumberLong(0),
"capacityUsed" : NumberLong(0),
"capacityMaxUsed" : NumberLong(2738745),
"capacityPushed" : NumberLong(3165389),
"capacityPulled" : NumberLong(3165389),
"capacityOverridden" : NumberLong(0),
"globalStartTimestamp" : ISODate("2021-03-16T19:33:24.172+0000"),
"exitCode" : NumberInt(0),
"state" : "COMPLETED"
}
],
"remoteAddress" : "127.0.0.1",
"remotePort" : NumberInt(8081)
}
],
"sessionTransformers" : [
{
"streamName" : "rwr",
"failed" : false,
"lastInstance" : NumberLong(1511),
"state" : {
"lastElementInstance" : NumberLong(150568),
"outputFormat" : "COMPRESSED_STRINGS",
"compressType" : "XZ",
"fileIndex" : NumberLong(5),
"firstLine" : true,
"outputFields" : [
"index",
"episode",
"timestamp",
"source",
"type",
"subSource",
"threadId",
"id",
"name",
"core",
"parameters",
"fileIndex",
"globalTimestamp",
"linkedIndex",
"processDuration"
],
"fieldsCount" : NumberInt(15)
},
"seriesDescriptors" : [
{
"seriesName" : "fileIndex",
"seriesType" : "STRING_TO_NUMBER"
},
{
"seriesName" : "globalTimestamp",
"seriesType" : "STRING_TO_DATE"
},
{
"seriesName" : "timestamp",
"seriesType" : "STRING_TO_NUMBER"
},
{
"seriesName" : "index",
"seriesType" : "STRING_TO_NUMBER"
},
{
"seriesName" : "episode",
"seriesType" : "STRING_TO_NUMBER"
},
{
"seriesName" : "source",
"seriesType" : "STRING_TO_STRING"
},
{
"seriesName" : "type",
"seriesType" : "STRING_TO_STRING"
},
{
"seriesName" : "id",
"seriesType" : "STRING_TO_STRING"
},
{
"seriesName" : "name",
"seriesType" : "STRING_TO_STRING"
},
{
"seriesName" : "core",
"seriesType" : "STRING_TO_NUMBER"
},
{
"seriesName" : "parameters",
"seriesType" : "STRING_TO_STRING"
},
{
"seriesName" : "linkedIndex",
"seriesType" : "STRING_TO_NUMBER"
},
{
"seriesName" : "processDuration",
"seriesType" : "STRING_TO_NUMBER"
},
{
"seriesName" : "threadId",
"seriesType" : "STRING_TO_NUMBER"
},
{
"seriesName" : "subSource",
"seriesType" : "STRING_TO_STRING"
},
{
"seriesName" : "dwords",
"seriesType" : "STRING_TO_STRING"
},
{
"seriesName" : "timestamp48",
"seriesType" : "STRING_TO_STRING"
}
]
}
],
"sessionAnalysers" : [
{
"streamName" : "rwr",
"analysisName" : "eva_rwr",
"lastInstance" : NumberLong(150568),
"failed" : false,
"state" : {
"eva" : {
"scriptPackageData" : BinData(0, "UEsDBBQAAAAAAAkacFLxjgYRMAEAADAB.. 4461486 more bytes"),
"com_eva_core_ThreadManager0_activeThreadId_s" : NumberInt(2),
"com_eva_core_ThreadManager0_activeThreadName_s" : "INP",
"eva_analysis_done_evaCheckerPassCount" : NumberLong(1)
}
},
"seriesDescriptors" : [
{
"seriesName" : "evaCheckerName",
"seriesType" : "STRING_TO_STRING",
"keyName" : "evaCheckSummaryKey",
"valueName" : "Checker Name",
"alwaysNew" : false
},
{
"seriesName" : "evaCheckerPassCount",
"seriesType" : "STRING_TO_NUMBER",
"keyName" : "evaCheckSummaryKey",
"valueName" : "Passed",
"alwaysNew" : false
},
{
"seriesName" : "evaCheckerFailCount",
"seriesType" : "STRING_TO_NUMBER",
"keyName" : "evaCheckSummaryKey",
"valueName" : "Failed",
"alwaysNew" : false
},
{
"seriesName" : "evaCheckerTotalCount",
"seriesType" : "STRING_TO_NUMBER",
"keyName" : "evaCheckSummaryKey",
"valueName" : "Total",
"alwaysNew" : false
},
{
"seriesName" : "evaCheckerPassRate",
"seriesType" : "STRING_TO_STRING",
"keyName" : "evaCheckSummaryKey",
"valueName" : "Pass Rate",
"alwaysNew" : false
},
{
"seriesName" : "evaCheckerSeverity",
"seriesType" : "STRING_TO_NUMBER",
"keyName" : "evaCheckSummaryKey",
"valueName" : "Severity",
"alwaysNew" : false
},
{
"seriesName" : "evaCheckerDescription",
"seriesType" : "STRING_TO_STRING",
"keyName" : "evaCheckSummaryKey",
"valueName" : "Description",
"alwaysNew" : false
},
{
"seriesName" : "evaCheckerFailRows",
"seriesType" : "STRING_TO_STRING",
"keyName" : "evaCheckSummaryKey",
"valueName" : "Fail Row IDs",
"alwaysNew" : false
},
{
"seriesName" : "evaPrintText",
"seriesType" : "STRING_TO_STRING",
"keyName" : "evaCheckSummaryKey",
"valueName" : "Text",
"alwaysNew" : false
},
{
"seriesName" : "evaPlotTable0",
"seriesType" : "STRING_TO_STRING",
"keyName" : "evaCheckSummaryKey",
"valueName" : "val0",
"alwaysNew" : false
},
{
"seriesName" : "evaPlotTable1",
"seriesType" : "STRING_TO_STRING",
"keyName" : "evaCheckSummaryKey",
"valueName" : "val1",
"alwaysNew" : false
},
{
"seriesName" : "evaPlotTable2",
"seriesType" : "STRING_TO_STRING",
"keyName" : "evaCheckSummaryKey",
"valueName" : "val2",
"alwaysNew" : false
},
{
"seriesName" : "evaPlotTable3",
"seriesType" : "STRING_TO_STRING",
"keyName" : "evaCheckSummaryKey",
"valueName" : "val3",
"alwaysNew" : false
},
{
"seriesName" : "evaPlotTable4",
"seriesType" : "STRING_TO_STRING",
"keyName" : "evaCheckSummaryKey",
"valueName" : "val4",
"alwaysNew" : false
},
{
"seriesName" : "evaPlotTable5",
"seriesType" : "STRING_TO_STRING",
"keyName" : "evaCheckSummaryKey",
"valueName" : "val5",
"alwaysNew" : false
},
{
"seriesName" : "evaPlotTable6",
"seriesType" : "STRING_TO_STRING",
"keyName" : "evaCheckSummaryKey",
"valueName" : "val6",
"alwaysNew" : false
},
{
"seriesName" : "evaPlotTable7",
"seriesType" : "STRING_TO_STRING",
"keyName" : "evaCheckSummaryKey",
"valueName" : "val7",
"alwaysNew" : false
}
]
}
]
},
}