Stop 07 · NoSQL DatabasesTopics · 10/12

When to Use NoSQL

Part of the Backend Developer Roadmap

In short

NoSQL isn't better or worse than SQL; it's a different tool. Picking well comes down to a few honest questions about your data and your traffic.

Recognizing the signals that point toward a NoSQL database — flexible/evolving schemas, massive horizontal scale needs, or naturally hierarchical data — versus when SQL is still the better default.

The blob stands at a junction choosing between a bicycle, an auto-rickshaw and a train.

Think of it like this

Cycle, auto or train?

Going two lanes away? Cycle. Across town with bags? Auto. Delhi to Mumbai? Train. Nobody argues about which vehicle is 'best'; it depends on the trip. Databases are the same. Work out what the trip looks like, then pick the ride.

Watch it happen

Four questions, then a choice

Relations
Shape
Scale
Latency
Decide

1/5Lots of related data and transactions, like payments or marks? SQL is the safe default.

The big ideas

What you need to know

SQL is the default

Structured, related data with transactions suits SQL. Most apps start there and stay there.

Varying shapes

When each record has different fields, documents avoid wide tables full of NULLs.

Massive scale on simple keys

Very high write volume across many servers or regions is where Cassandra and DynamoDB earn their keep.

Mix and match

Using two databases for different jobs is normal. Just don't add one without a clear reason.

See it in code

Walk through the code

ts
1type Need = {2  strongTransactions: boolean;3  shapeVaries: boolean;4  hugeWritesOnKey: boolean;5  needsFastCache: boolean;6};7 8export function pickStores(n: Need): string[] {9  const picks = ["PostgreSQL"]; // sensible default for core data10  if (n.shapeVaries && !n.strongTransactions) picks[0] = "MongoDB";11  if (n.hugeWritesOnKey) picks.push("Cassandra or DynamoDB");12  if (n.needsFastCache) picks.push("Redis");13  return picks;14}

1/4Four honest questions about your data and traffic.

A toy rule of thumb, not a law. Real choices also depend on your team's skills and what your cloud offers.

Save yourself the pain

Common mistakes

Oops

Choosing a database because a big tech company's blog uses it.

Do this instead

Their scale isn't yours. Pick what fits your data and what your team can run well.

Oops

Adding MongoDB, Redis and Cassandra to a college project on day one.

Do this instead

Every database is one more thing to back up, secure and learn. Add one when a real need appears.

Your mission

Pick for five apps

~15 min

Quick check

A wallet app moves money between user accounts. What's the best main database?

Go deeper

  1. 1List the specific requirements of a project you know and decide SQL vs NoSQL for it.
  2. 2Learn that 'NoSQL is more scalable' is often oversimplified — SQL databases scale very far too.
  3. 3Recognize that many production systems use SQL as the source of truth and NoSQL/Redis for specific hot paths.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge