【发布时间】:2022-01-11 20:18:08
【问题描述】:
我有 145359 个文档存储在本地 MongoDB 中,我正在尝试对其进行索引。加快我的查询速度。
{
"Categorized": true
}
示例文档
{
"_id" : "dbe14c04-bd1e-454a-af57-4ca61566c0c0",
"Categorized" : true,
"Archived" : false,
"HasTorrent" : false,
"TorrentFile" : null,
"File" : {
"TitlePattern" : null,
"Extension" : ".mp4",
"FileName" : "A Costume for Nicholas (Un Disfraz para Nicolas) (2020) 1080p WEBRip.mp4",
"FileNameWithoutExtension" : "A Costume for Nicholas (Un Disfraz para Nicolas) (2020) 1080p WEBRip",
"AdapterName" : "CandyBD",
"AdapterNameLower" : "candybd",
"Type" : 1,
"SupportedISPs" : [
"dotinternet"
]
},
"IsSaved" : false,
"IsUpdated" : true,
"MovieId" : "tt8045396",
"Quality" : 16,
"UpdateComplete" : true,
"WatchCount" : 0,
"Is3D" : false,
"FileFoundDateTime" : ISODate("2022-01-03T02:12:03.236Z"),
"InformationDateTime" : ISODate("2022-01-03T02:12:11.553Z"),
"Dimension" : "1080p",
"IsDubbed" : false
}
问题是当试图索引集合时
{
"Categorized" : 1
}
根据罗盘返回的文档:94057 和已检查的文档:索引前的 145359 中的 94057,很好。但事情是在索引 Actual Query Execution Time (ms):95 (around) 和 CollScan Execution Time 为 0-11 平均 4 ms 之前。但是在索引 Actual Query Execution Time (ms):124 之后,Fetch 大约是 9 ms,Ixscan 大约是 5 ms。
这个值是什么意思,为什么我的查询在索引后执行的时间似乎更长了?
【问题讨论】:
标签: mongodb indexing execution-time mongodb-compass