...

>

Types of Databases

Types of Databases

Understand the key differences between relational databases and NoSQL systems, including ACID guarantees and scaling approaches. Evaluate common NoSQL models, document, graph, and key-value, and their trade-offs. Choose an appropriate database architecture based on the constraints of the system design problem.

Databases are commonly grouped into two categories: relational and NoSQL (non-relational).

Relational databases

Relational databases enforce a predefined schema before storing data. Data is organized into relations (tables) composed of tuples (rows) and attributes (columns). Each tuple has a unique key. Because data is structured, a tuple in one table can link to a tuple in another using a foreign key.

Structured Query Language (SQL) is used to manage the database, handling data insertion, deletion, and retrieval.

Relational databases are dominant due to their simplicity, robustness, flexibility, and scalabilityTraditional databases are vertically scalable. Vertical scaling has limits. One might reach a point when more compute, memory, storage, or networking capability could not be added to a single node.. To maintain data integrity, relational databases provide (ACID) properties. ACID is a powerful abstraction that automatically handles complex anomalies (such as dirty reads, lost updates, and phantom reads), simplifying application logic.

However, ACID guarantees can be overkill for some use cases. If an application can tolerate specific anomalies, a custom solution might offer higher performance, though it adds implementation complexity.

The ACID offers the following properties:

  • Atomicity: Transactions are atomic units. Either all statements in a transaction execute successfully, or none do. Failed transactions are aborted and rolled back. ...