Bookmarks

NoSQL — NoSQL

A family of databases that store data without the relational model — as documents, key-value pairs, columns or a graph.

Also: non-relational databases, not only SQL

checked 9 Nov

All terms

NoSQL is not a single product or a standard but an umbrella term for databases that have moved away from the relational model. Each family solves its own problem: billions of small records across hundreds of servers, streams of events and metrics, data without a rigid structure.

The name took hold on 11 June 2009 after an informal meetup in San Francisco organised by Johan Oskarsson, where Cassandra, HBase, CouchDB and MongoDB were demonstrated. Earlier, “NoSQL” was the name of a small relational DBMS created by Carlo Strozzi in the late 1990s — it has no bearing on the modern meaning.

Four families

FamilyWhat it storesExamplesTypical use case
DocumentJSON and BSON documents nested inside one anotherMongoDB, CouchDBprofiles, catalogues, content with varying fields
Key-valuea value with no internal structure, accessed by keyRedis, DynamoDBcaches, sessions, shopping carts, counters
Wide-columnrows grouped into column familiesCassandra, HBaseevent streams, metrics, time series
Graphnodes and relationships with propertiesNeo4jconnections and paths: recommendations, fraud detection

How they differ from relational databases

There is no fixed schema in advance: documents with different fields sit side by side in a single MongoDB collection, and a new field requires no migration. Horizontal scaling is usually built into the core — sharding and replication are configured by the database itself. JOIN gives way to nested documents and denormalisation: related data is stored right inside the document.

Flexibility comes at the cost of consistency. Early systems traded it for availability, as the CAP theorem describes: Cassandra provides eventual consistency, and the consistency level is set per write and read operation. Transactions later made a comeback: in MongoDB, multi-document ACID transactions work on replica sets and in sharded clusters.

When to choose it

  • sessions, caches and counters with millisecond responses — a key-value store (Redis);
  • product listings and profiles with per-record fields — a document database (MongoDB);
  • an event stream of hundreds of thousands of records per second — a wide-column database (Cassandra);
  • finding paths and connections between entities — a graph database (Neo4j).

“NoSQL” is also read as “not only SQL” — a rejection not of the SQL language but of the relational model as the only option. NoSQL databases have their own SQL-like query languages: CQL in Cassandra works with the same tables, rows and columns, while PostgreSQL stores JSON documents in jsonb columns. In practice, a relational and a NoSQL database are often deployed side by side, each for its own task.

Sources

the term is written from these pages

Verified 9 Nov

Not to be confused with

what it is mixed up with and how it differs

  • ACIDACID transaction properties

    ACID is about transaction properties, not a database type: relational DBMSs provide them by default, while in NoSQL they vary, from eventual consistency to multi-document transactions.

  • sharding

    Sharding is a way to spread data across nodes; relational DBMSs can do it too, but NoSQL systems more often provide it out of the box.

In depth in the references

where the topic is covered in detail