NoSQL

Also known as: non-relational database

On this page 7

NoSQL (often read as not only SQL) is the umbrella term for non-relational database models that store data in structures other than tables joined by foreign keys, chiefly documents, key-value pairs, wide-column families and graphs. Among database models, NoSQL systems are designed around flexible or schema-less data, horizontal scaling across many servers and access patterns that a single relational server handles poorly.

NoSQL is a category defined largely by what it is not, so the systems inside it differ more from one another than from relational databases in some respects. What they share is a design philosophy: model data for the queries the application runs, accept weaker or tunable consistency where it buys availability or speed, and distribute data by partitioning and replication.

How NoSQL databases organize data

A relational database normalizes data into tables and reassembles it with joins at query time. NoSQL systems usually do the opposite: they store data in the shape it is read, often denormalized so that one lookup returns everything a request needs. Related information is embedded in one record or duplicated across several, and the application takes responsibility for keeping copies in step.

To scale, most NoSQL databases split data into partitions or shards using a partition key, then replicate each partition to several nodes. A good key spreads load evenly; a poor one creates hot partitions where one node receives most traffic. Queries that include the partition key are fast, while queries across all partitions are expensive or unsupported.

The main NoSQL database models

Four models form the core of NoSQL, with time-series and vector databases often grouped alongside them. Each model optimizes a different access pattern.

ModelData structureTypical systemsBest fit
Key-value storeOpaque value under a unique keyRedis, DynamoDB, RiakCaching, sessions, simple lookups
Document databaseJSON-like documents with nested fieldsMongoDB, Couchbase, FirestoreContent, catalogs, user profiles
Wide-column databaseRows with dynamic columns in column familiesCassandra, HBase, ScyllaDBHigh write volume, time-ordered data
Graph databaseNodes and relationships with propertiesNeo4j, Amazon NeptuneNetworks, recommendations, fraud paths
Core NoSQL data models

Many products are now multi-model databases that combine several of these structures, and many relational databases support JSON columns. The boundary between NoSQL and relational systems has therefore become a spectrum rather than a wall.

Consistency, availability and the CAP theorem

Distributed NoSQL systems must decide what happens when nodes cannot communicate. The CAP theorem states that during a network partition, a system must choose between consistency (every read sees the latest write) and availability (every request receives a response). The PACELC extension adds that even without partitions there is a trade-off between latency and consistency.

ApproachBehaviorExample setting
Strong consistencyReads always reflect the latest committed writeSingle-leader writes with majority reads
Eventual consistencyReplicas converge if updates stopDefault reads in many key-value stores
Tunable consistencyClient chooses replicas per operationQuorum reads and writes in Cassandra
Session guaranteesRead-your-writes within one client sessionCausal consistency sessions
Consistency approaches in NoSQL systems

With tunable consistency, a common rule is that when the number of replicas read plus the number written exceeds the replication factor, reads overlap with the latest write. With three replicas, quorum writes and quorum reads of two satisfy that condition. Early NoSQL systems favored BASE semantics, which put availability and soft state ahead of immediate consistency, but many now offer ACID transactions within a document, a partition or even across partitions.

NoSQL compared with relational and NewSQL databases

Choosing between NoSQL, relational and NewSQL systems is a question of data shape, query flexibility and scale. The comparison summarizes the typical differences, though individual products blur them.

AspectRelationalNoSQLNewSQL
SchemaFixed, enforced by the databaseFlexible, often enforced by the applicationFixed, relational
Query languageSQL with joinsModel-specific APIs, limited joinsSQL
ScalingMainly vertical, read replicasHorizontal by designHorizontal with distributed transactions
TransactionsFull ACIDVaries from single record to multi-recordFull ACID
Ad hoc analysisStrongWeak to moderateStrong
Relational, NoSQL and NewSQL compared

Choosing NoSQL and common mistakes

NoSQL is the stronger choice when access patterns are known and stable, data is naturally hierarchical or highly variable, write volume exceeds what one server can absorb, or the system must stay available across regions. A relational database usually remains better for complex reporting, many-to-many relationships and strict integrity rules.

  • Treating schema-less as no design: the schema still exists in code, and inconsistent documents accumulate silently.
  • Porting a relational schema unchanged, which forces many round trips in place of missing joins.
  • Choosing a low-cardinality partition key, such as country or status, which creates hot partitions.
  • Assuming reads are always current when the default consistency level is eventual.
  • Ignoring unbounded document growth, for example appending every event to one record until it reaches size limits.

The safest process is to list the queries first, then design keys and record shapes so that each frequent query touches one partition. Polyglot persistence, using a relational database and one or more NoSQL stores side by side, is common in larger systems.

Explained without jargon

Traditional databases store information in neat tables with fixed columns, like a strict spreadsheet. NoSQL databases relax those rules. They might store each customer as one complete folder with everything about that customer inside, or simply keep labeled boxes that can be found by their label.

This flexibility makes it easier to spread data across many computers and to handle huge amounts of traffic. The cost is that some tasks a spreadsheet does easily, such as combining information in new ways, become harder. Teams choose NoSQL when speed and scale matter more than flexible reporting.

A typical use case

A mobile game with several million daily players needs to store player profiles, inventories and match results. The team uses a document database for profiles, keeping each player’s settings and items in one document that loads in a single read, and a key-value store for session tokens with expiry times.

Match events go into a wide-column database partitioned by player and day, which absorbs tens of thousands of writes per second during evening peaks. Billing and payments stay in a relational database where strict transactions matter. The result is fast reads under heavy load, with each store chosen for the access pattern it serves best.