System Design Academy

Saving…

Lesson 4 of 10 in Module 30 of 54 lessons complete

NoSQL Families

Module 3, lesson 4Concept12 min

Definition

NoSQL database

In plain English
A NoSQL database stores data in shapes other than linked tables, often trading some relational features for flexibility or scale.
Think of it like
It is like choosing a filing system shaped for your papers instead of forcing everything into one spreadsheet.

Why it exists

Your exhibit catalogue contains paintings, fossils, and sculptures. Each type needs different fields, so one rigid form becomes awkward.

Another app mostly follows chains of friendships. Its main question differs from finding one record by its ID.

JSON

In plain English
JSON is a text format that represents records with named fields, values, and lists.
Think of it like
It is like a labelled form that another program can read.

How it works

Key-value store

In plain English
A key-value store saves each value under a unique key and finds it only by that key.
Think of it like
Like a coat check: hand over the ticket, get the coat.

Document store

In plain English
A document store saves self-contained records, usually JSON, whose fields can differ from one record to the next.
Think of it like
Like a folder of forms where each form can have extra pages.

Wide-column store

In plain English
A wide-column store groups data by a key and stores many columns per key, built for huge write volumes spread over many machines.
Think of it like
Like a ledger with one long row per sensor, adding a new column for every reading.

Graph database

In plain English
A graph database stores things and the relationships between them, and is fast at following chains of links.
Think of it like
Like a map of who knows whom at a party.
FamilyShapeGood fitHarder work
Key-valueOne value per keyFetch one session by IDSearch inside arbitrary fields
DocumentSelf-contained recordsVaried exhibit fieldsCombine many related records
Wide-columnRows grouped by a keyLarge grouped reading streamsUnplanned questions across groups
GraphThings and linksFollow friendship chainsBulk numerical summaries

Alice follows Bob, and both Alice and Bob have attendance links to Stage A.

A graph makes relationships part of the stored data.

Alice follows Bob, and both Alice and Bob have attendance links to Stage A.

These families differ in query support, transactions, and scaling. NoSQL does not automatically mean faster, more scalable, or less correct. Products can add lookup tools beyond these basic models.

Examples

Keep different exhibit fields

You store paintings with artists and fossils with ages. Each exhibit becomes one document.

JSON represents two documents with different fields.
JSON
[
  {"id": "P7", "type": "painting", "artist": "Mira Sen"},
  {"id": "F9", "type": "fossil", "age_years": 65000000}
]

JSON uses named fields and values inside braces. Your app still validates required fields, even when the database allows different shapes.

The insight

Documents fit records whose shape varies.

Trade-offs

Pros

  • Shapes can match particular workloads.
  • Some products spread work across machines.
  • Direct access patterns can be efficient.

Cons

  • Joins and transaction support vary.
  • Queries often shape the stored layout.
  • New tools add operational work.

Use when

  • A known workload fits one family.
  • Measurements support the product choice.

Avoid when

  • Flexible questions and relationships dominate.
  • One relational database already meets your needs.

Quick check

You only ever fetch a shopping session by its session ID. Which family fits most simply?
"Show festival-goers who are friends of my friends and at the same stage." Which family is built for this?

Takeaways

  • NoSQL groups several different database families.
  • Choose by data shape and access pattern.
  • Check each product’s query and transaction guarantees.

Try the quick check above whenever you feel ready.

Previous: Transactions & ACID