DEV Community 👩‍💻👨‍💻

Cover image for System Design: NoSQL databases
Karan Pratap Singh
Karan Pratap Singh

Posted on • Originally published at github.com

System Design: NoSQL databases

NoSQL is a broad category that includes any database that doesn't use SQL as its primary data access language. These types of databases are also sometimes referred to as non-relational databases. Unlike in relational databases, data in a NoSQL database doesn't have to conform to a pre-defined schema. NoSQL databases follow BASE consistency model.

Below are different types of NoSQL databases:

Document

A document database (also known as a document-oriented database or a document store) is a database that stores information in documents. They are general-purpose databases that serve a variety of use cases for both transactional and analytical applications.

Advantages

  • Intuitive and flexible
  • Easy horizontal scaling
  • Schemaless

Disadvantages

  • Schemaless
  • Non-relational

Examples

Key-value

One of the simplest types of NoSQL databases, key-value databases save data as a group of key-value pairs made up of two data items each. They're also sometimes referred to as a key-value store.

Advantages

  • Simple and performant
  • Highly scalable for high volumes of traffic
  • Session management
  • Optimized lookups

Disadvantages

  • Basic CRUD
  • Values can't be filtered
  • Lacks indexing and scanning capabilities
  • Not optimized for complex queries

Examples

Graph

A graph database is a NoSQL database that uses graph structures for semantic queries with nodes, edges, and properties to represent and store data instead of tables or documents.

The graph relates the data items in the store to a collection of nodes and edges, the edges representing the relationships between the nodes. The relationships allow data in the store to be linked together directly and, in many cases, retrieved with one operation.

Advantages

  • Query speed
  • Agile and flexible
  • Explicit data representation

Disadvantages

  • Complex
  • No standardized query language

Use cases

  • Fraud detection
  • Recommendation engines
  • Social networks
  • Network mapping

Examples

Time series

A time-series database is a database optimized for time-stamped, or time series, data.

Advantages

  • Fast insertion and retrieval
  • Efficient data storage

Use cases

  • IoT data
  • Metrics analysis
  • Application monitoring
  • Understand financial trends

Examples

Wide column

Wide column databases, also known as wide column stores, are schema-agnostic. Data is stored in column families, rather than in rows and columns.

Advantages

  • Highly scalable, can handle petabytes of data
  • Ideal for real-time big data applications

Disadvantages

  • Expensive
  • Increased write time

Use cases

  • Business analytics
  • Attribute-based data storage

Examples

Multi-model

Multi-model databases combine different database models (i.e. relational, graph, key-value, document, etc.) into a single, integrated backend. This means they can accommodate various data types, indexes, queries, and store data in more than one model.

Advantages

  • Flexibility
  • Suitable for complex projects
  • Data consistent

Disadvantages

  • Complex
  • Less mature

Examples


This article is part of my open source System Design Course available on Github.

Top comments (0)

DEV has this feature:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. 🛠