A database is a collection of data stored in a specific way so as to allow efficient storage and retrieval of data.
A Database Management System(DBMS) is software that interacts with a database providing an interface for creating, modifying, and querying a database. Examples of DBMS include SQL Server, MySQL, PostgreSQL, Oracle, and MongoDB.
Types of Database Management Systems (DBMS)
There are hundreds of databases that have different properties and are optimized for special functionalities. It’s difficult to group the databases, however, when we look at the structure imposed on the data we can come up with two main groups: relational and non-relational databases.
Relational Databases
Non-Relational Databases
Choosing a Database
Always keep in mind the following factors when choosing a database for a new application:
Data model - Consider the structure of your data and how it will be stored and retrieved. If your data is highly structured and requires complex relationships, a relational database like MySQL or PostgreSQL may be a better fit. If your data is unstructured or semi-structured, a NoSQL database like MongoDB or Cassandra may be more appropriate.
Scale - How much data do you expect to store and how quickly do you need to retrieve it? If you expect to store a large amount of data and need to scale horizontally, a NoSQL database may be better suited for your needs.
Performance - Consider the performance requirements of your application. Some databases are better suited for high-write workloads, while others are optimized for high-read workloads.
Availability and durability - Consider how important it is for your application to be available and how you will ensure data durability. Some databases offer built-in replication and fault tolerance, while others require additional setup and configuration.
Transactions - The ACID properties in relational databases give you a guarantee of data atomicity, consistency, isolation, and durability when dealing with transaction operations.
Cost - Consider the total cost of ownership, including licensing, hardware, and maintenance costs.
It’s important to note that there is no one-size-fits-all solution and the best database for your application will depend on your specific requirements. When engineering at scale is all about trade-offs. Effortless horizontal scalability in NoSQL databases comes with a hidden cost. It’s important to dive deep to find out where that cost is hiding.