“We’ll use MongoDB, it’s NoSQL, so it’s faster and we don’t have to worry about schemas.” Variations of this sentence get said in many design meetings. Each half of it deserves some suspicion. NoSQL is a useful family of tools, but the folklore around it hides what you are actually signing up for.
First, the term itself. “NoSQL” does not describe one technology. It covers several quite different designs: document stores like MongoDB, key-value stores like Redis or DynamoDB, wide-column stores like Cassandra, and graph databases like Neo4j. What they share is mostly what they are not: they do not follow the classic relational model with fixed tables and joins. They differ from each other as much as they differ from PostgreSQL.
Belief one: NoSQL is faster
Faster at what? A key-value store retrieving a value by its key can be extremely quick, because it does little else. A relational database retrieving a row by primary key is also quick. The differences appear when you move away from the access pattern the system was designed for.
Cassandra and DynamoDB are built to spread huge write volumes across many machines, and they do it well, provided you know in advance which queries you will run, because the data is laid out around those queries. Ask for something the layout does not support, say “all orders above ₹5,000 from last month, any customer”, and you either scan everything or you build a second copy of the data organised differently. A relational database with a suitable index answers that flexibly. So NoSQL is often faster for a narrow set of known access patterns at very large scale, and not faster in general. For a business application with a few million rows, a well-indexed relational database on one decent server is usually more than fast enough, and a lot more flexible.
Belief two: there is no schema
A document database will happily store one customer document with a phone field and the next without it. That flexibility is real and useful when data is varied or evolving. But your application code still expects certain fields to exist and to have certain types. The schema has not vanished; it has moved from the database into the code, where it is enforced by hope.
The honest term is schema-on-read versus schema-on-write. With a relational table, the database rejects bad data when it is written. With a flexible store, bad data goes in, and the failure shows up months later when a report meets a document with "amount": "1,200" as text. Many teams end up adding validation rules after all, and MongoDB, for instance, supports schema validation for exactly this reason. Using it is usually a good idea.
Belief three: NoSQL cannot do transactions or consistency
This was closer to true a decade ago. Today it depends on the product and its settings. MongoDB supports multi-document transactions in recent versions. DynamoDB offers transactional reads and writes with limits. Many distributed stores let you tune consistency per operation, trading latency for stronger guarantees. Meanwhile relational databases can be run in modes that relax guarantees too, for example with asynchronous replicas that lag behind the primary.
The CAP theorem is often quoted here. It says that when a network partition happens, a distributed system must choose between consistency and availability. It describes behaviour during failures, not a label you can stick on a product. Read the actual documentation for the version you use; defaults differ, and so do the failure modes.
Belief four: it scales better, so use it from day one
Horizontal scaling, adding more machines, was a founding motivation for many NoSQL systems. Relational databases historically scaled up (bigger machine) and used read replicas, and sharding them is harder. That difference is real, and it matters at large scale. But most applications never reach it. Starting with a relational database and moving specific, proven-heavy workloads elsewhere later is cheaper than building the whole product around the trade-offs of a distributed store you did not yet need. Premature scaling choices cost real things: weaker ad-hoc querying, no joins, and more application code to keep related data in step.
When NoSQL is the right call
- Data that is naturally a self-contained document, such as a product catalogue entry with varied attributes by category, read mostly as a whole.
- Very high write throughput with predictable key-based access, like device telemetry or activity logs.
- Caching, sessions and counters, where a key-value store fits well.
- Highly connected data where relationships are the question, such as recommendations or fraud rings, where a graph database traverses links far more naturally than repeated joins.
And when it is not: anything with strong relationships between entities and many different ways of querying them, such as accounting, inventory or HR systems. Those want constraints, joins and transactions, and a relational database provides them with decades of tooling.
Many real systems use both. An order system may keep orders in PostgreSQL and product search in a search engine, with a cache in front. The mature question is not “SQL or NoSQL?” but “what are the access patterns, the consistency needs and the expected scale, and which store fits each part?”
Leave a Reply