SQL vs NoSQL: How to Actually Choose
The honest default for most apps is Postgres, and NoSQL is a tool you reach for with a reason, not a lifestyle. Here is how to tell which one your project actually needs.
Key takeaways
- SQL databases like PostgreSQL, MySQL, and SQL Server store data in tables with a fixed schema and enforce ACID transactions, which guarantee that a group of writes either all succeed or all fail together.
- NoSQL is an umbrella for four different shapes: document stores like MongoDB, key-value stores like Redis and DynamoDB, wide-column stores like Cassandra, and graph databases like Neo4j.
- The core tradeoff is ACID versus BASE: SQL prioritizes strong consistency and rigid structure, while most NoSQL systems relax consistency in exchange for horizontal scale and flexible, schema-optional data.
- SQL databases traditionally scale vertically by adding a bigger machine, while NoSQL systems are built to scale horizontally by spreading data across many commodity machines from day one.
- For most applications the right default is a relational database like PostgreSQL, and NoSQL is the right call only when a specific reason justifies it, such as extreme write scale, a genuinely schemaless data shape, or a graph-heavy access pattern.
Every few years someone tells you the relational database is dead and the future is NoSQL. Then a few years after that, someone tells you NoSQL was a mistake and everyone is coming back to Postgres. Both takes are wrong, and both are exhausting. The real question was never which one wins. It is which one fits the thing you are building, and most of the time the answer is quieter than the debate.
Here is my honest bias up front. For the overwhelming majority of applications, the right choice is a boring relational SQL database like PostgreSQL. NoSQL is not a philosophy or a default. It is a set of specialized tools you reach for when you have a specific, nameable reason. If you can't say the reason out loud in one sentence, you probably don't have it yet.
Summary
What SQL actually is
SQL databases are relational. You define tables, each table has columns with types, and rows are records that fit that shape. A users table, an orders table, a products table, and you link them with keys so an order knows which user placed it. The structure is the point. You decide up front what the data looks like, and the database refuses to store anything that violates the plan.
The other half of what makes SQL SQL is ACID. It stands for Atomicity, Consistency, Isolation, and Durability, and the plain-English version is that a group of changes either all happen or none of them do, and once the database says a write is saved, it stays saved even if the power dies a second later.[1] When money moves from one account to another, you want the debit and the credit to be inseparable. ACID is what makes that guarantee real instead of hopeful. PostgreSQL, MySQL, and SQL Server all live here.
Plain English
NoSQL is four different things wearing one name
The single most confusing thing about “NoSQL” is that it isn't one technology. It is a category defined by what it is not. Under that umbrella live at least four genuinely different database shapes, and lumping them together is how people end up comparing MongoDB to Redis as if they solve the same problem.
Document stores like MongoDB keep data as JSON-like documents, so an entire order with its line items can live in one record instead of being spread across five tables.[2]Key-value stores like Redis and Amazon DynamoDB map a key straight to a value and do it blindingly fast, which is why they run so many caches and session stores. Wide-column stores like Apache Cassandra organize data into column families and are built to absorb enormous write volume across a cluster. Graph databases like Neo4j store nodes and the relationships between them, which makes questions like “friends of friends who bought this” cheap instead of a nightmare of joins.
Takeaway
When someone says “we should use NoSQL,” the first question is always: which kind? A document store, a key-value store, a wide-column store, and a graph database have almost nothing in common except that none of them are relational tables.
ACID vs BASE, the real tradeoff
The philosophical split under the hood is ACID versus BASE. BASE stands for Basically Available, Soft state, Eventually consistent, and it is the mindset a lot of distributed NoSQL systems were built around.[3] Instead of guaranteeing every reader sees the latest write immediately, the system promises it will get there eventually, and in exchange it stays available and scales across many machines even when some of them are slow or down.
This traces back to the CAP theorem, the idea that when a distributed system gets partitioned by a network failure, you have to choose between consistency and availability, you can't keep both.[4] SQL databases traditionally chose consistency. Many NoSQL systems chose availability. Neither choice is wrong. They are answers to different questions, and the right one depends entirely on whether a slightly stale read is a minor annoyance or a serious bug.
“Eventually consistent is fine for a like counter. It is not fine for an account balance. Know which one your data is before you pick.”
The important caveat is that this line has blurred a lot. MongoDB added multi-document ACID transactions back in version 4.0, so the old “NoSQL can't do transactions” line is out of date.[2]And Postgres has handled JSON documents natively for years. The two camps borrowed each other's best ideas. But the defaults and the strengths still point in the directions they always did.
Schema: rigid on purpose vs flexible on purpose
SQL's fixed schema feels like a constraint, and it is, but I think of it as a feature that catches bugs at the door. If your code tries to save an order with no customer, the database rejects it. The structure is a contract, and the contract is enforced by something dumber and more reliable than your application code. Migrations are the tax you pay: changing the shape of a big table takes planning.
Document stores flip this. You can throw a new field on one record and not the next, and nothing complains. Early in a project, when you don't yet know the shape of your data, that flexibility feels amazing. The catch shows up later. “Schemaless” doesn't mean there is no schema. It means the schema now lives scattered across your application code instead of in one enforced place, and every reader has to defend against every historical variation of every document. You didn't remove the structure. You just stopped having anything guard it.
Heads up
Scaling: vertical vs horizontal
The scaling story is where NoSQL earned its reputation. Traditional SQL databases scale vertically. When you need more, you buy a bigger machine, more CPU, more RAM, faster disks. That works remarkably far, further than most people believe, but there is a ceiling and the biggest machine is expensive. NoSQL systems like Cassandra and DynamoDB were designed to scale horizontally instead, spreading data across many cheap machines and letting you add capacity by adding nodes.[5] When you are operating at the scale of a top-ten website, that architectural difference is decisive.
Here is the honest counterpoint, though. The number of applications that actually hit the ceiling of a single well-tuned Postgres instance is small. Modern Postgres reads scale out with replicas, and extensions handle sharding when you truly need it. Most teams that reached for a horizontally scaling NoSQL store “for scale” were solving a problem they did not have yet, and they paid for it in lost transactions, awkward queries, and eventual consistency bugs. The way I think about database choice is a lot like the way I think about broader architecture patterns: solve the problem in front of you, not the one you imagine you'll have at a hundred times your current size.
When each one actually wins
Reach for SQL when your data has relationships, when correctness matters, and when you'll ask questions you can't predict yet. Anything with users, orders, payments, inventory, or accounts is relational at its core, and the ad-hoc query power of SQL means you can answer new business questions without re-modeling your data. This is most CRUD apps, most SaaS products, most internal tools. It is the boring, correct default.
Reach for a specific NoSQL store when you have a specific reason. A key-value store like Redis in front of your database as a cache, similar to how a CDN caches content closer to users, is one of the highest-leverage NoSQL uses there is. A document store fits genuinely self-contained, schema-varying data like product catalogs or event logs. A wide-column store fits write-heavy time-series or telemetry at massive scale. A graph database fits data that is mostly about connections, social graphs, recommendation engines, fraud rings. Notice these are reasons, not vibes.
| Your situation | Pick | Why |
|---|---|---|
| CRUD app, SaaS, anything with money or accounts | SQL (PostgreSQL) | Relationships, ACID, ad-hoc queries, boring reliability |
| Caching, sessions, rate limiting | Key-value (Redis) | Microsecond lookups, in front of your real database |
| Self-contained docs, varying shape, huge catalogs | Document (MongoDB) | Flexible schema, whole entity in one record |
| Massive write volume, time-series, telemetry | Wide-column (Cassandra) | Horizontal write scale across a cluster |
| Data that is mostly about connections | Graph (Neo4j) | Traversals are cheap instead of a wall of joins |
And you don't have to pick one forever. Plenty of serious systems run Postgres as the source of truth and bolt on Redis for caching and a search index alongside. Using more than one datastore is normal, and it's a separate decision from how you split up your code, which is more of a monorepo versus polyrepo question than a database one.
What I'd do
Start with PostgreSQL. Almost every time. It handles relational data, it does JSON when you need document-style flexibility, it's ACID by default, it scales further than your first few years of growth will demand, and it is free and everywhere. The failure mode I see most often is a small team choosing a distributed NoSQL database on day one because they read that it's what big companies use, then spending the next year fighting eventual consistency and re-implementing joins in application code they didn't need to write.
Then add NoSQL surgically, when the reason is real and you can name it. Cache with Redis the moment read load justifies it. Move a specific write-heavy or graph-shaped workload to the right specialized store when it actually outgrows relational tables. That is the whole framework. SQL is the default you justify moving away from, not the choice you have to defend. Reach for NoSQL for a reason, and you'll almost never regret it.
Sources and further reading
- 1.PrimaryPostgreSQL Documentation, "Transactions". How transactions bundle multiple steps into an all-or-nothing unit; the basis of ACID guarantees in a relational database.
- 2.PrimaryMongoDB Documentation, "Transactions". Multi-document ACID transactions in MongoDB, available since version 4.0; document-model data storage.
- 3.ReportingWikipedia, "Eventual consistency". The BASE model (Basically Available, Soft state, Eventually consistent) and how it contrasts with ACID.
- 4.ReportingWikipedia, "CAP theorem". A partitioned distributed system must trade consistency against availability; the theoretical root of the SQL/NoSQL split.
- 5.PrimaryAmazon Web Services, "Amazon DynamoDB Developer Guide". Horizontal scaling and key-value/document data model of a managed NoSQL database built to spread load across many nodes.
Frequently asked questions
- What is the difference between SQL and NoSQL?
- SQL databases store data in tables with rows and columns defined by a fixed schema, and they use ACID transactions to keep data consistent. NoSQL is a broad category of non-relational databases that store data as documents, key-value pairs, wide columns, or graphs, and they usually trade some consistency for the ability to scale across many machines. The short version is that SQL enforces structure and correctness up front, while NoSQL trades some of that for flexibility and horizontal scale.
- Should I use SQL or NoSQL for my project?
- For most projects you should start with a relational SQL database like PostgreSQL, because it handles structured data, relationships, and transactions well and scales further than people expect. Reach for NoSQL when you have a concrete reason: write volume beyond what a single machine can serve, a data shape that genuinely does not fit tables, or an access pattern like graph traversal that relational tables model poorly. Picking NoSQL by default, before you have that reason, usually creates more problems than it solves.
- What does ACID mean, and does NoSQL support it?
- ACID stands for Atomicity, Consistency, Isolation, and Durability, four guarantees that keep a database correct even when transactions overlap or the system crashes mid-write. Traditional SQL databases are ACID-compliant by design. Many NoSQL systems historically favored the looser BASE model instead, but this has blurred: MongoDB added multi-document ACID transactions in version 4.0, and several NoSQL engines now offer configurable consistency. So the honest answer is that most NoSQL can do ACID now, but it is often not the default and not the thing it is optimized for.
- What are the four types of NoSQL databases?
- The four main types of NoSQL databases are document stores, key-value stores, wide-column stores, and graph databases. Document stores like MongoDB keep data as JSON-like documents. Key-value stores like Redis and Amazon DynamoDB map a key to a value for very fast lookups. Wide-column stores like Apache Cassandra organize data into column families for huge write throughput. Graph databases like Neo4j store nodes and relationships, which makes traversing connections cheap.
- How do SQL and NoSQL databases scale differently?
- SQL databases have traditionally scaled vertically, meaning you handle more load by moving to a bigger, more powerful server, though modern Postgres can also scale reads with replicas and shard with extensions. NoSQL databases are built to scale horizontally from the start, spreading data across many cheaper machines so you add capacity by adding nodes. Horizontal scale is the main structural reason large systems reach for NoSQL, but a single well-tuned Postgres instance handles far more than most apps will ever need.
Written by
Tech Talk News Editorial
Computer engineering background. Writes about software, AI, markets, and real estate, and the places where the three meet.
More about the author