In this article, you’ll learn what a NoSQL database is, why (and when!) you should use one, and how to get started. When people use the term “NoSQL database”, they typically use it to refer to any non-relational database. Some say the term “NoSQL” stands for “non-SQL” while others say it stands for “not only SQL”. Either way, most agree that NoSQL databases are databases that store data in a format other than relational tables.

What is a NoSQL database?

NoSQL is a type of database management system (DBMS) that is designed to handle and store large volumes of unstructured and semi-structured data. Unlike traditional relational databases that use tables with pre-defined schemas to store data, NoSQL databases use flexible data models that can adapt to changes in data structures and are capable of scaling horizontally to handle growing amounts of data.

How Does a NoSQL (nonrelational) Database Work?

NoSQL databases use a variety of data models for accessing and managing data. These types of databases are optimized specifically for applications that require large data volume, low latency, and flexible data models, which are achieved by relaxing some of the data consistency restrictions of other databases.

Consider the example of modeling the schema for a simple book database:

  • In a relational database, a book record is often dissembled (or “normalized”) and stored in separate tables, and relationships are defined by primary and foreign key constraints. In this example, the Books table has columns for ISBNBook Title, and Edition Number, the Authors table has columns for AuthorID and Author Name, and finally, the Author-ISBN table has columns for AuthorID and ISBN. The relational model is designed to enable the database to enforce referential integrity between tables in the database, normalized to reduce redundancy, and generally optimized for storage.
  • In a NoSQL database, a book record is usually stored as a JSON document. For each book, the item, ISBNBook TitleEdition NumberAuthor Name, and AuthorID are stored as attributes in a single document. In this model, data is optimized for intuitive development and horizontal scalability.


Types of NoSQL databases

Over time, four major types of NoSQL databases emerged: document databases, key-value databases, wide-column stores, and graph databases.

  1. Document databases: These databases store data in documents similar to JSON (JavaScript Object Notation) objects. Each document contains pairs of fields and values. The values can typically be a variety of types including things like strings, numbers, booleans, arrays, or objects.
  2. Key-value stores: These databases are a simpler type of database where each item contains and store data as key-value pairs, and are optimized for simple and fast read/write operations.
  3. Column-family stores: These databases store data as column families, which are sets of columns that are treated as a single entity. They are optimized for fast and efficient querying of large amounts of data.
  4. Graph databases: These databases store data as nodes and edges, and are designed to handle complex relationships between data. Nodes typically store information about people, places, and things, while edges store information about the relationships between the nodes.
  5. In-memory: Gaming and ad-tech applications have use cases such as leaderboards, session stores, and real-time analytics that require microsecond response times and can have large spikes in traffic coming at any time. 
    1. Amazon MemoryDB for Redis is a Redis-compatible, durable, in-memory database service that delivers microsecond read latency, single-digit millisecond write latency and Multi-AZ durability.
    2. MemoryDB is purpose-built to deliver ultra-fast performance and durability so you can use it as your primary database for modern, microservices applications. 
    3. Amazon ElastiCache is a fully managed, in-memory caching service compatible with both Redis and Memcached, to serve low-latency, high-throughput workloads. Customers like Tinder, who require real-time response from their applications, rely on in-memory data stores rather than disk-based data stores. 
    4. Amazon DynamoDB Accelerator (DAX) is another example of a purpose-built data store.
    5. DAX makes DynamoDB reads an order of magnitude faster.
  6. Search: Many applications output logs to help developers troubleshoot issues. Amazon OpenSearch Service is purpose-built for providing near-real-time visualizations and analytics of machine-generated data by indexing, aggregating, and searching semi-structured logs and metrics. Amazon OpenSearch Service is also a powerful, high-performance search engine for full-text search use cases. Expedia is using more than 150 Amazon OpenSearch Service domains, 30 TB of data, and 30 billion documents for a variety of mission-critical use cases, ranging from operational monitoring and troubleshooting to distributed application stack tracing and pricing optimization.


Why should you use a NoSQL database?

NoSQL databases are a great fit for many modern applications such as mobile, web, and gaming that require flexible, scalable, high-performance, and highly functional databases to provide great user experiences.

  • Flexibility: NoSQL databases generally provide flexible schemas that enable faster and more iterative development. The flexible data model makes NoSQL databases ideal for semi-structured and unstructured data.
  • Scalability: NoSQL databases are generally designed to scale out by using distributed clusters of hardware instead of scaling up by adding expensive and robust servers. Some cloud providers handle these operations behind the scenes as a fully managed service.
  • High-performance: NoSQL databases are optimized for specific data models and access patterns that enable higher performance than trying to accomplish similar functionality with relational databases.
  • Highly functional: NoSQL databases provide highly functional APIs and data types that are purpose-built for each of their respective data models.
What is NoSQL? Nonrelational Databases, Flexible Schema Data

Leave a Comment