MediumSQL vs NoSQL: It’s Really About the Guarantees You Need | by Khushi Verma | Nov, 2026 | Medium
Sitemap
Khushi Verma

Khushi Verma

Software Engineer

SQL vs NoSQL: It’s Really About the Guarantees You Need

5 min read5 days ago

--

Choosing a database is really choosing which guarantees your data needs. A beginner-friendly guide to SQL, NoSQL and ACID.

Press enter or click to view image in full size

Imagine two things happening at the same moment.

You send ₹500 to a friend through your banking app. At the same time, someone across the world likes your photo on Instagram.

Both are just “writes” to a database. But if the bank gets it wrong, money disappears. If Instagram gets it wrong, a like shows up one second late, and nobody notices.

That difference is the whole story of SQL vs NoSQL. It isn’t about which database is better. It’s about which guarantees your data actually needs.

What is a SQL database?

A SQL database (also called a relational database) stores data in tables made of rows and columns, like a spreadsheet. Popular examples are PostgreSQL and MySQL.

Three things define it:

  • Fixed schema: you decide the columns and their types before storing any data. Every row must follow that structure.
  • Joins: related data lives in separate tables, connected by keys. A users table and an orders table are linked by user_id, and you combine them with a JOIN when you need both.
  • Vertical scaling: when it gets slow, the usual first move is a bigger machine with more CPU, RAM and faster disks.

SQL shines when your data is structured and the relationships between it matter. But its biggest strength is the promise it makes about every transaction.

ACID: the promise SQL makes

A transaction is a group of steps that must succeed or fail together. Sending ₹500 is really two steps: take ₹500 from my account, then add ₹500 to my friend’s account.

ACID is the set of four guarantees that keep that transfer safe:

  • Atomicity (all or nothing): if the credit fails, the debit is undone. Money is never half-moved.
  • Consistency (data always follows the rules): a rule like “balance can’t go below zero” is never broken.
  • Isolation (parallel transactions don’t interfere): if I send two payments at once, both see the correct balance.
  • Durability (once saved, never lost): after “Success”, the transfer survives even if the server crashes a second later.
Press enter or click to view image in full size

For money, orders and inventory, these guarantees are non-negotiable. That’s why banks run on SQL.

What is a NoSQL database?

NoSQL means “not only SQL”. These databases don’t force data into rigid tables, and they were built for a different problem: huge amounts of data and traffic spread across many machines.

What sets them apart:

  • Flexible schema: you can add a new field to one record without changing all the others.
  • Few or no joins: data that is read together is stored together. This is called denormalization: duplicating some data on purpose so reads don’t need joins.
  • Horizontal scaling: instead of one bigger machine, you add more machines and spread the data across them.
Press enter or click to view image in full size

NoSQL isn’t one thing. There are four main types, each built around how it stores data:

  1. Key-value (like a dictionary: key to value). Example: Redis. Good for caching and login sessions.
  2. Document (like a JSON object). Example: MongoDB. Good for user profiles and product catalogs.
  3. Column (a huge table built for fast writes). Example: Cassandra. Good for logs, IoT data and massive write volume.
  4. Graph (dots connected by lines). Example: Neo4j. Good for social networks and recommendations.
Press enter or click to view image in full size

A trick to remember the order: KDCG, “Keep Data Clean and Grouped”.

The real difference: strict guarantees vs eventual consistency

Here’s where the two halves of this article meet.

Get Khushi Verma’s stories in your inbox

Join Medium for free to get updates from this writer.

Keeping full ACID guarantees across many machines is hard and slow, because every machine has to agree before a write counts. So many NoSQL databases relax that promise in exchange for speed and scale. Instead of “every copy is correct right now”, they promise “every copy will be correct soon”. This is called eventual consistency.

Back to Instagram. When you like a photo, the like is saved on one server first and copied to the others a moment later. For that moment, your friend might see 99 likes while you see 100. A second later, both of you see 100.

For likes, that’s perfectly fine. For a bank balance, it’s a disaster.

That’s the trade:

  • SQL (ACID): correct right now, every time. Harder to scale.
  • NoSQL (often eventually consistent): fast and massively scalable. Copies may disagree briefly.

One honest caveat: this is a tendency, not a rule. Some NoSQL databases, like MongoDB, now support ACID transactions, and some SQL setups trade a little consistency for speed. But as a starting mental model, it holds up well.

Press enter or click to view image in full size

How to choose

Choose SQL when:

  • Your data is structured and related (users, orders, products).
  • Correctness matters more than anything (payments, inventory).
  • You need joins and complex queries.
  • Examples: PostgreSQL, MySQL.

Choose NoSQL when:

  • Your data is flexible or changes shape often.
  • You have huge volume or traffic and need to scale across many machines.
  • A slightly late value is fine (feeds, likes, logs, caching).
  • Examples: MongoDB, Redis, Cassandra, Neo4j.

A simple way to decide: ask what happens if this data is wrong or late for one second. If the answer is “someone loses money”, reach for SQL. If the answer is “nobody notices”, NoSQL is a strong option.

And in practice, you rarely pick just one. A real app like Instagram could keep logins and payments in a SQL database, photos and feeds in a document or column store, and sessions in Redis. Each part of the system uses the database that fits its guarantees.

Key takeaways

  • SQL stores structured data in related tables with a fixed schema, and scales mainly by getting a bigger machine.
  • ACID (atomicity, consistency, isolation, durability) makes every SQL transaction all-or-nothing, valid, independent and permanent.
  • NoSQL trades rigid structure for flexibility and horizontal scale, in four main types: key-value, document, column and graph.
  • Many NoSQL systems relax ACID for eventual consistency: copies agree soon, not instantly.
  • Choose by asking what a wrong or late value would cost. Most real systems use both.

So the next time you send money or like a photo, remember: both are just writes to a database. What makes them different isn’t the data, it’s the promise behind it. Pick your database by the promise your data needs.

--

--