Navigation
You were redirected from a different version of the documentation. Click here to go back.

Improve Your Schema

Note

This feature is available only with Cloud Manager Premium, which comes with certain MongoDB subscriptions. Contact MongoDB for more information.

Your schema is the architecture of your cluster, including your collections, indexes and documents. Cloud Manager offers two ways to detect common schema design issues and suggests modifications that follow MongoDB’s best practices:

  • The Performance Advisor provides holistic schema recommendations for your cluster by sampling documents in your most active collections and collections with slow-running queries.
  • The Data Explorer offers schema suggestions for a specific collection by sampling documents in that collection.

Schema Suggestions

To learn more about how to apply the suggestions offered in either the Performance Advisor or Data Explorer, refer to the following pages:

Schema Improvement Reason for Suggestion
Reduce $lookup Operations You are running too many $lookup operations on your data. Take advantage of MongoDB’s rich schema model to embed related data in a single collection.
Avoid Unbounded Arrays Your documents contain array fields with many elements, which can degrade query performance.
Remove Unnecessary Indexes You have unnecessary indexes in your collection, which can consume disk space and degrade write performance.
Reduce the Size of Large Documents You have excessively large documents, which can degrade the performance of your most frequent queries.
Reduce Number of Collections You have an exceedingly high number of collections in a database, which can result in unnecessary disk space usage.
Improve Case-Insensitive Regex Queries You are executing case-insensitive regex queries which could be improved with an index.

Limitations of Schema Suggestions

  • Schema suggestions for a collection are partly driven by a random sampling of documents from that collection. Because this sampling is performed each time your schema is analyzed, you may see different suggestions at different times for the same collection.
  • The Performance Advisor uses slow query logs as an input to recognize certain schema issues, namely too many $lookup operations and not utilizing an index for case-sensitive regex queries. If a collection does not have any operations that last longer than 100 milliseconds, the Performance Advisor may not suggest all potential improvements for that collection, or may not show all reasons why an improvement is being suggested.
  • The Performance Advisor analyzes the 20 most active collections based on the output of the top command. To see suggestions for a specific collection, view that collection in the Data Explorer.