Lesson 7: Using Atlas Tools for Schema Help / Learn

Press O for more options
3:27

Video Transcript (English)

Hello! In this video, you will learn about schema anti-patterns and the tools that MongoDB provides to identify them. We’ll use the Data Explorer and the Performance Advisor in Atlas to find schema suggestions.

As a prerequisite to this unit, you should have basic knowledge of CRUD operations, data modeling, indexes, and MongoDB Atlas.

Schema design patterns are guidelines that help developers plan, organize, and model data.

When applications are developed without following schema best practices, it can result in suboptimal performance or non-scalable solutions.

The most common schema anti-patterns include: Massive arrays, Massive number of collections, Bloated documents, Unnecessary indexes, Queries without indexes, and Data that’s accessed together but stored in different collections.

It’s not always easy to recognize these anti-patterns. But some of the tools available in MongoDB Atlas can help us identify and resolve them.

Let’s see two of these tools in action: Data Explorer and Performance Advisor.

The first tool, Data Explorer, is available with the free tier of Atlas. In Atlas, click Browse collections to access the Data Explorer. Here we can select a collection and view the storage size, number of documents, and total index size.

The Indexes tab shows the collection indexes and their stats. This helps us identify unnecessary indexes that can be dropped.

The Schema Anti-Pattern tab highlights any issues in the collection and provides details to resolve them.

We’ll select “Learn How to Fix This Issue” to read more about this first anti-pattern and then follow the guidelines to remove it.

In this case, we need to view the indexes and their usage. We’ll order by the Usage column, and identify the ones that have not been used based on the recent queries. Then we will determine if they can be deleted. If we know some of these indexes are not being used, we’ll click “Drop Index.”

This brings us to the second tool, the Atlas Performance Advisor. The Performance Advisor can tell us which indexes are redundant.

When working in a M10 tier or higher, the Performance Advisor section provides recommendations to improve the performance of the most active collections and collections with slow-running queries.

The Performance Advisor section shows index recommendations, identifies unnecessary indexes, and highlights issues with the schema.

Now let’s recap what you learned in this video:

Atlas allows us to identify and address schema design anti-patterns.

The Data Explorer is available with the free tier of Atlas. It shows schema anti-patterns as well as collection and index stats for each collection.

The Performance Advisor is available in an M10 tier and higher. This tool analyzes the most active collections and provides recommendations to improve the schemas.