A database is a software component that’s critical in just about every single modern application. There are myriad databases in use, and their number keeps growing. Understanding the major categories of databases will help you choose the one that’s right for you.
For the purposes of this article, we’ll use the terms “database” and “database management system” (DBMS: software that enables users to access, interact with, and manipulate a database) interchangeably.
This article provides a brief overview of databases—what they are, what they’re used for, and how to determine which one to use.
TABLE OF CONTENTS
A database management system is software to store, organize, manage, and retrieve data. Think of it like a group of massive spreadsheets that organize information in a structured format. There are various kinds of databases, and each is typically housed on servers, whether located in a data center or—as is increasingly the case—virtually, on cloud infrastructure.
Databases come in a variety of shapes, sizes, and flavors, each designed to do different things with different kinds of data. MongoDB, for example, is a general-purpose, document-based, distributed database built for modern application developers.
Databases are used in most modern applications, whether they are on your phone, on your computer, or on the internet. They store much of the data an application needs to function, keeping it organized and accessible to users.
If you were building an e-commerce app, some of the information stored in your database might include:
There are nearly a dozen different types of databases in use today. Some of the more commonly used types of database management system (DBMS) include the following:
Originally developed in the 1960s, hierarchical databases look similar to a family tree. A single object (the “parent”) has one or more objects beneath it (the “child”). Child records can’t have more than one parent. In exchange for this rigid and complex navigation structure, hierarchical databases also offer high performance, as there’s a quick querying time to find what you need. The Windows Registry is a well-known example of a hierarchical database.
Relational databases are quite popular, even though it was a system designed in the 1970s. Also known as relational database management systems (RDBMS), relational databases commonly use Structured Query Language (SQL) for operations such as creating, reading, updating, and deleting data.
Relational databases store information in discrete tables, which can be joined together by fields known as foreign keys. For example, you might have a User table which contains information about all your users, and join it to a Purchases table, which contains information about all the purchases they’ve made. MySQL, Microsoft SQL Server, and Oracle are types of relational databases.
Non-relational database management systems are commonly referred to as NoSQL. They matured as a response to the needs of increasingly complex modern web applications, and their varieties have proliferated over the last decade.
Sometimes, when we say NoSQL database management systems, we mean any database that does not use a relational model. Different NoSQL database management systems store information in different ways. For example:
NoSQL database management systems differ from RDBMS in that they can be schema-agnostic, allowing unstructured and semi-structured data to be readily stored and processed. NoSQL databases come in many varieties designed for different needs and use cases. Compared to relational databases, they’re highly performant for large sets of data and better at scaling up to meet increased demands.
For more information on the differences between RDBMS and NoSQL, see this article.
Different types of databases have different strengths and weaknesses. Since RDBMS systems are so popular, it is worth exploring what advantages a non-relational database like NoSQL has over them.
NoSQL databases have emerged as a compelling alternative as they boast the following advantages:
For more information on the differences between these two database types, see this article.
While the venerable RDBMS is not likely to disappear anytime soon, the clear development, functional, and total cost of ownership advantages of NoSQL databases—especially the document-oriented Database-as-a-Service variety in the cloud—will only increase their popularity and penetration in the years ahead.
Because they can handle ever-changing data formats, NoSQL databases are becoming a more popular alternative for teams that want to be able to iterate quickly. Platforms like Atlas App Services leverage NoSQL’s scalability to easily facilitate synchronization between different devices, like mobile, desktop, and cloud.
Because data doesn’t need to fit within the confines of a strict relationship, MongoDB can operate as a general data store. This provides several advantages over other types of databases.
Data stored in MongoDB maps to a flexible schema. If your application’s needs change, you can easily restructure how your data is stored. This allows you to iterate much more quickly on new ideas. Since MongoDB also provides schema validation, you have the ability to lock down your schema as much or as little as you'd like. This means that it can handle whatever your data structuring needs might be—or might be required in the future.
In a relational database, relationships between data in different tables can be achieved through joins, and within hierarchical databases, relationships across nodes is impossible. MongoDB provides the ability to join documents through operations that match a variety of needs, such as $lookup, as well as through references.
Lastly, unlike many other NoSQL databases, MongoDB supports transactions, which guarantees atomicity of reads and writes to multiple documents. When you need to query data from multiple documents, you can rest assured knowing that the queries can be combined into a single transaction.
MongoDB was designed from the ground up to support applications in an internet age, where users can manipulate data from any number of places. Its out-of-the-box support for replication, load balancing, and aggregation make it a versatile part of modern software architecture. It can even offer schema suggestions to help you make choices that optimize for MongoDB’s document data model.
This blog post also outlines some more advantages in choosing MongoDB.
MongoDB Atlas is a multi-cloud document database service. It’s an on-demand fully managed service run by a team of MongoDB sysadmins, so that you can focus on what matters: your own application. MongoDB Atlas database hosting is available on various cloud providers, such as AWS, Microsoft Azure, and Google Cloud Platform, which ensures that it can serve your needs no matter where you are.
There are many different types of databases available, and each has their own advantages and disadvantages, depending on the type of data they are storing. Before deciding which database is right for your project, it’s crucial to get a broad understanding of how your data relates to your application, and more importantly, how you anticipate your data to evolve in the future.
Using a flexible NoSQL database like MongoDB can satisfy the needs of both a traditional, highly structured data set as well as a dataset that requires a flexible schema to allow for changing app requirements. Since NoSQL databases were designed with scaling in mind, they can also grow alongside your business needs.
There are a variety of database types. The three primary types are relational databases, non-relational databases, and hierarchical databases.
There are relational databases, non-relational databases, and hierarchical databases.
The more commonly used types of databases are: