What Is NoSQL?

What is a NoSQL database?

Why use NoSQL?

NoSQL Use Cases


What is a NoSQL database?

A NoSQL database (also known as “no SQL” or “not only SQL”) is a distributed, non-relational database designed for large-scale data storage and massively parallel, high-performance data processing across many commodity systems. Unlike the traditional relational database approach, NoSQL gives you a way to work with data closer to the application. It is a modern data storage paradigm that provides data persistence for environments where high performance is the primary requirement. Within a NoSQL database, data is stored so that both writing and reading are fast, even under heavy load.

NoSQL databases are typically distributed systems where several machines work together in clusters. Each piece of data is replicated over those machines to deliver redundancy and high availability. The ability to store vast amounts of data in a distributed manner makes NoSQL databases faster to develop and deploy. NoSQL databases are built for specific data models and have flexible schemas, allowing programmers to create and manage modern applications.

A NoSQL datastore is non-relational, distributed, flexible, and scalable. Additionally, some common features of NoSQL database management systems include data clustering, flexible schema, replication support, and eventual consistency, which compares to traditional SQL database systems’ usual ACID transaction capability ensuring data integrity.

Unlike SQL databases, NoSQL database systems were initially developed as open source, with almost all of them now having an enterprise option available. Open source allows for a large community of supporters who contribute to the database, which increases innovation and the variety of solutions it addresses. Having an open source option means that developers can quickly and easily try new NoSQL databases at no cost.

What is Redis NoSQL?

Redis is an open source, in-memory key-value data structure store, which can be used as a database, cache, or message broker. It’s a NoSQL database. Redis Enterprise is based on open source Redis and is also a NoSQL database but also includes vital functionality to make it enterprise-hardened and includes Redis support.  Redis Enterprise is infinitely and linearly scalable, has 5-9s high availability, and can be easily geo-distributed. Open source Redis is entirely compatible with Redis Enterprise.

A brief history of NoSQL databases

With the start of Web 2.0, the creation of various data types exploded, and the price of storage significantly dropped, causing the challenges associated with maintaining and accessing data to shift. Relational databases, consisting of rows and columns, were designed for structured data requiring complex analysis and operations of often connected data.  

With the rapid growth of unstructured data, relational databases’ structural and scaling limitations came into focus. Flexibility and the ability to handle large amounts of data quickly became requirements. In the late 2000s, NoSQL databases emerged, with the advantages of storing data more intuitively and in formats that suit today’s applications. NoSQL databases solve problems that can’t be solved with SQL or relational databases.

Type of NoSQL databases

There are five major NoSQL database types: key-value store, document store, in-memory, column-oriented database, and graph database. Implementing a NoSQL database is often a combination of these five database types.

Key-value stores are the least complex of the NoSQL databases. They are a collection of key-value pairs, and their simplicity makes them the most scalable of NoSQL databases types. Key-value can be a string, a number, and an entirely new set of key-value pairs encapsulated in an object. Use cases include shopping carts, user preferences, and leaderboards.

Document stores are one step up in complexity from key-value stores. NoSQL document-based databases store information in documents with specific keys, similar to a key-value store, but with different benefits and disadvantages. Document stores appear the most natural among the NoSQL database types because they store everyday documents. They allow for complex querying and calculations on this often already aggregated form of data. Document databases store data in CML, YAML, JSON, or binary documents such as BSON. Using specific keys makes document stores similar to key-value stores. Use cases include online retail, trading platforms, and mobile app development across industries.

In-memory databases are data stores that are purpose-built to rely on DRAM for data storage to enable sub-millisecond responses. This is in contrast to most NoSQL and SQL databases that store data on disk or SSD/flash memory. It means that each time you query an in-memory database or update data in a database, you only access the main memory. There’s no disk involved in these operations. And this is good, because the main memory is much faster than any disk. In-memory databases can also retain persistent data by keeping each operation on a disk in a transaction log or a snapshot. Use cases include leaderboards, session stores, and real-time analytics. 

Column-oriented databases store data in tables that contain large numbers of columns (in a flexible schema). In a column-oriented database, it’s easy to add another column because none of the existing columns are affected by it. Storing each column separately allows for quicker scans when only a few columns are involved. Use cases include performing analytics and reporting, including summing values and counting entries. 

A graph database is the most complex data store, geared toward efficiently storing relations between entities. Graph databases are the answer when the data is highly interconnected, such as social networks, scientific paper citations, or capital asset clusters. Use cases include fraud detection, social networks, and knowledge graphs.

Why use NoSQL?

NoSQL datastores became popular during Web 2.0 in response to the need to handle large amounts of data and traffic. NoSQL databases store data in simple, straightforward forms that can be easier to understand than the type of data models used in SQL databases. NoSQL databases allow for great adaptability and flexibility, making them a more suitable choice when handling large sets of unstructured data, and they are used across every industry. In addition, NoSQL databases often allow developers to change the structure of the data directly.

NoSQL Use Cases

The structure of many different forms of data is more easily handled with a NoSQL database. NoSQL databases are often better suited to storing and modeling structured, semi-structured, and unstructured data in one database. Given the significant amount of managed data, NoSQL’s scalability is crucial. NoSQL databases are flexible since the data you store in a NoSQL database does not need a predefined schema as is the case with a SQL database.

Each of these database types described above (key-value store, document store, in-memory, column-oriented database, and graph database) suits a specific requirement and data type. Often databases use a combination of these types to provide the maximum flexibility possible.

When to use a key-value database

The value of a key-value database is simplicity, speed, scalability, and reliability. Key-value databases also offer fast in-memory access and are great for when your application needs to handle lots of small, continuous reads and writes that may be volatile. Use a key-value database when storing basic information, such as customer details, storing web pages with the URL as the key and the webpage as the value, when storing shopping-cart contents, product categories, ecommerce product details, and for applications that don’t require frequent updates or need to support complex queries. RediSearch is a  search engine that runs on your Redis dataset and allows you to query data that has just been indexed.

Key-value database use cases:

  • Session management on a large scale 
  • Using cache to accelerate application responses
  • Storing personal data on specific users
  • Product recommendations, storing personalized lists of items for individual customers
  • Managing each player’s session in massive multiplayer online games
  • Real-time random data access, e.g., user session attributes in an online application such as gaming or finance

When to use a document database

Use a document-based database when you need to store each record as a document that has specific characteristics. Document databases are popular with developers because they have the flexibility to rework their document structures as needed to suit their application, shaping their data structures as their application requirements change over time. One of the most significant benefits of document databases is that they store data in JSON format, which is the native format for JavaScript. Due to their flexible schema, document databases are perfect for collecting and storing any type of data. You can use them to create and incorporate new types of content, including user-generated content, such as images, comments, and videos. RedisJSON makes JSON a native data structure in Redis. It’s tailored for fast, efficient, in-memory manipulation of JSON documents at high speed and volume. 

Document database use cases:

  • Customer data management and personalization
  • Internet of Things (IoT) and time-series data
  • Product catalogs and content management
  • Payment processing
  • Mobile apps
  • Operational analytics
  • Real-time analytics

When to use an in-memory database

An in-memory database often uses one of the other NoSQL data types such as key-value. Given that all data is accessible from DRAM, an in-memory database provides sub-millisecond speed. In-memory NoSQL databases are designed for scalability to quickly handle sudden growth and peaks in demand. You should use an in-memory database when real-time response time is required, which is becoming expected in most digital applications. Redis Enterprise is an open source, Redis-compatible database that provides persistence and durability while delivering sub-millisecond latency with high availability. Redis Enterprise is perfect for your primary database for modern, microservices applications that can run in the cloud, on-premises, hybrid, or multi-cloud. Redis as a cache is a fully managed, in-memory caching to provide low latency and high throughput.

In-memory database use cases:

  • Financial services
  • Ecommerce 
  • Payment processing
  • Fraud detection
  • Healthcare
  • Gaming

When to use a column-oriented database

At a basic level, column-oriented databases do precisely as advertised: instead of organizing information into rows, they do so in columns. This essentially makes them function the same way that tables work in relational databases. Of course, since this is a NoSQL database, this data model makes them much more flexible. Column-oriented databases are used in data warehouses where businesses send massive amounts of data from multiple sources for BI analysis and have faster query performance. The column design keeps data closer together, reducing seek time. These databases are ideal for use cases requiring a large dataset distributed across multiple database nodes, especially when the columns are not always the same for every row.

Column-oriented database use cases: 

  • Analytics and reporting
  • Data warehousing 
  • Big data processing

When to use a graph database

Graph databases uncover relationships across diverse data. Graph databases are often purpose-built to store and navigate relationships that store data in nodes and edges. Nodes typically store information about people, places, and things, while edges store information about the relationships between the nodes. Graph databases are very good at traversing relationships between small data entities but are not ideally suited for storing a lot of properties on a single node or large values in those properties. RedisGraph is based on a novel approach that translates graph queries to matrix operations, enabling you to evaluate relationships in a highly parallelized way.

Graph database use cases: 

  • Fraud detection
  • Social media
  • Real-time recommendations  
  • Network and IT operations


USE NoSQL with in memory in it

To put it simply, SQL databases, also known as relational database management systems (RDBMS), are relational, and NoSQL databases are non-relational. SQL databases use a structured query language, SQL, and have a predefined schema. NoSQL databases have dynamic schemes perfect for unstructured data. SQL databases are exclusively vertically scalable, while NoSQL databases can scale vertically or horizontally, which gives them much more ability to scale to handle large amounts of data. Horizontal scaling has a greater overall capacity than vertical scaling, making NoSQL databases the preferred choice for large and frequently changing data sets. SQL databases are table-based (rows and columns), while NoSQL comes in many flavors, including key-value, document, in-memory, column-oriented, and graph. SQL databases are better suited for multi-row transactions commonly used for legacy systems built around a relational structure, while NoSQL is better for unstructured data like documents or JSON. NoSQL database systems deliver scalability for larger data sets, common in analytics and artificial intelligence applications. NoSQL is better suited for the cloud, mobile, social media, and big data requirements.

SQL vs. NoSQL: Comparison Table

DBMS SQL databases NoSQL databases
Type Relational database Non-relational database
Structure SQL databases organize and store data by table and fixed columns and rows NoSQL databases can be key-value, document column-oriented, and graph
Schema Fixed schema Dynamic schema
Scalability Vertical scalability Horizontal and vertical scalability
Query Structured Query Language (SQL) No declarative query language; it depends on the database type

Next section  ►  Key-Value Databases