When MongoDB Compass determines that your schema or queries can be improved, it displays a performance insight. Performance insights show ways to improve your schema and data modeling practices. Use performance insights to learn best schema design practices and improve application performance.当MongoDB Compass确定模式或查询可以改进时,它会显示性能洞察。性能洞察展示了改进模式和数据建模实践的方法。使用性能洞察来学习最佳模式设计实践并提高应用程序性能。
Use Cases用例
Performance insights are best followed early in your application development process. Starting your application with good data modeling practices helps prevent schema and performance issues as your application grows.最好在应用程序开发过程的早期遵循性能见解。使用良好的数据建模实践启动应用程序有助于在应用程序增长时防止模式和性能问题。
Although Compass provides performance insights at any stage of development, it can be difficult to make schema modifications in large-scale schemas that are used in production.尽管Compass在开发的任何阶段都提供了性能见解,但在生产中使用的大规模模式中进行模式修改可能很困难。
Before you modify your schema based on performance insights, ensure that the suggestion makes sense for your application. For example, if Compass suggests creating an index, make sure that index supports queries that are run frequently.在根据性能见解修改模式之前,请确保该建议对应用程序有意义。例如,如果Compass建议创建索引,请确保该索引支持频繁运行的查询。
Behavior行为
Performance insights are enabled automatically.性能洞察会自动启用。
Performance insights are generic, and do not use properties specific to your schema such as database or collection names.性能洞察是通用的,不使用特定于模式的属性,如数据库或集合名称。
Compass shows performance insights in the following scenarios:Compass显示了以下场景中的性能见解:
$lookup stage.$lookup阶段的聚合管道。 | $lookup operation.$lookup操作。 |
$text or $regex query.$text或$regex查询。 | |
Learn More了解更多
To learn more about data modeling in MongoDB, see Data Modeling.要了解有关MongoDB中数据建模的更多信息,请参阅数据建模。To learn how to create effective indexes for your application, see Indexing Strategies.要了解如何为应用程序创建有效的索引,请参阅索引策略。