|
| 1 | +.. _compass-performance-insights: |
| 2 | + |
| 3 | +==================== |
| 4 | +Performance Insights |
| 5 | +==================== |
| 6 | + |
| 7 | +.. default-domain:: mongodb |
| 8 | + |
| 9 | +.. contents:: On this page |
| 10 | + :local: |
| 11 | + :backlinks: none |
| 12 | + :depth: 2 |
| 13 | + :class: singlecol |
| 14 | + |
| 15 | +When |compass| determines that your schema or queries can be improved, |
| 16 | +it displays a performance insight. Performance insights show ways to |
| 17 | +improve your schema and data modeling practices. Use performance |
| 18 | +insights to learn best schema design practices and improve application |
| 19 | +performance. |
| 20 | + |
| 21 | +Use Cases |
| 22 | +--------- |
| 23 | + |
| 24 | +Performance insights are best followed early in your application |
| 25 | +development process. Starting your application with good data modeling |
| 26 | +practices helps prevent schema and performance issues as your |
| 27 | +application grows. |
| 28 | + |
| 29 | +Although |compass-short| provides performance insights at any stage of |
| 30 | +development, it can be difficult to make schema modifications in |
| 31 | +large-scale schemas that are used in production. |
| 32 | + |
| 33 | +Before you modify your schema based on performance insights, ensure that |
| 34 | +the suggestion makes sense for your application. For example, if |
| 35 | +|compass-short| suggests creating an index, make sure that index |
| 36 | +supports queries that are run frequently. |
| 37 | + |
| 38 | +Behavior |
| 39 | +-------- |
| 40 | + |
| 41 | +Performance insights are enabled automatically. |
| 42 | + |
| 43 | +Performance insights are generic, and do not use properties specific to |
| 44 | +your schema such as database or collection names. |
| 45 | + |
| 46 | +|compass-short| shows performance insights in the following scenarios: |
| 47 | + |
| 48 | +.. list-table:: |
| 49 | + :header-rows: 1 |
| 50 | + :widths: 10 10 |
| 51 | + |
| 52 | + * - Scenario |
| 53 | + - Performance insight |
| 54 | + |
| 55 | + * - You run a query or aggregation without an index. |
| 56 | + - Add an index to support the operation. |
| 57 | + |
| 58 | + * - You run an aggregation pipeline that uses a :pipeline:`$lookup` |
| 59 | + stage. |
| 60 | + - Embed related data to avoid the need for a ``$lookup`` operation. |
| 61 | + |
| 62 | + * - You run a :query:`$text` or :query:`$regex` query. |
| 63 | + - If possible, use :atlas:`Atlas Search </atlas-search>` to improve |
| 64 | + performance for text search queries. |
| 65 | + |
| 66 | + * - Your database contains too many collections. |
| 67 | + - Reduce the number of collections. |
| 68 | + |
| 69 | + * - Your documents contain an array field with too many elements. |
| 70 | + - Avoid unbounded arrays. |
| 71 | + |
| 72 | + * - The data size of individual documents is too large. |
| 73 | + - Break up large documents into separate collections. |
| 74 | + |
| 75 | + * - Your collection contains too many indexes. |
| 76 | + - Review your indexes and remove any that are unnecessary. |
| 77 | + |
| 78 | +Learn More |
| 79 | +---------- |
| 80 | + |
| 81 | +- To learn more about data modeling in MongoDB, see |
| 82 | + :ref:`manual-data-modeling-intro`. |
| 83 | + |
| 84 | +- To learn how to create effective indexes for your application, see |
| 85 | + :manual:`Indexing Strategies </applications/indexes>`. |
0 commit comments