MongoDB provides several ways to examine the performance of your workload, allowing you to understand query performance and identify long-running queries. Understanding query performance helps you build effective indexes and ensure your application runs critical queries efficiently.MongoDB提供了几种检查工作负载性能的方法,使您能够了解查询性能并识别长时间运行的查询。了解查询性能有助于构建有效的索引,并确保应用程序高效运行关键查询。
Identify Slow Queries识别慢速查询
Use the following methods to identify slow queries that occur on your deployment.使用以下方法识别部署中出现的慢速查询。
Performance Overview性能概述
The following methods provide overviews of your deployment's performance. Use these methods to determine if there are performance issues that need to be addressed:以下方法概述了部署的性能。使用这些方法确定是否存在需要解决的性能问题:
| M10+ Atlas | ||
| M10+ Atlas | ||
| ||
| ||
$queryStats aggregation stage returns information about common query shapes. $queryStats provides a holistic view of the kinds of queries being run on your deployment.$queryStats聚合阶段返回有关常见查询形状的信息。$queryStats提供了在部署上运行的查询类型的整体视图。 | ||
$indexStats aggregation stage returns information about your collection's indexes and how often individual indexes are used. Use $indexStats to identify unused indexes that can be removed to improve write performance.$indexStats聚合阶段返回有关集合索引的信息以及单个索引的使用频率。使用$indexStats来识别可以删除以提高写入性能的未使用索引。 | ||
|
Analyze a Slow Query分析慢速查询
Use these methods to analyze a slow query and determine the cause of poor performance:使用以下方法分析慢速查询并确定性能不佳的原因:
| M10+ Atlas | ||
| ||
| ||
|
Perform Advanced Query Analysis执行高级查询分析
The following methods are suited for deeper investigation of problematic queries, and can provide fine-grained performance insights:以下方法适用于对有问题的查询进行更深入的调查,并可以提供细粒度的性能见解:
|