[ ARTICLE_004 ] / DB_CHOICE
SQL vs NoSQL - Pick the Right Tool
A practical breakdown of when relational databases serve you and when document stores do. Neither is universally better.
The SQL vs NoSQL debate is mostly noise. Both are good databases. Neither is inherently faster, more modern, or more scalable. They solve different problems, and the mistake is picking one for the wrong reasons.
What SQL Actually Is
A relational database stores data in tables with defined columns and enforces relationships between them. The guarantees it provides are not optional extras - they are the point:
- ACID transactions - atomicity, consistency, isolation, durability. Either all of it commits or none of it does.
- Schema enforcement - the database rejects data that does not fit. That is a feature, not a limitation.
- Joins - query across related tables in a single statement. The query planner handles the heavy lifting.
- Referential integrity - a foreign key constraint means you cannot have an order referencing a user that does not exist.
PostgreSQL, MySQL, and SQLite all fit this model. They have been battle-tested for decades and handle enormous scale - Shopify, GitHub, and Instagram all ran on Postgres.
What NoSQL Actually Is
NoSQL is an umbrella term covering document stores, key-value stores, column-family databases, and graph databases. The common thread is that they trade some relational guarantees for flexibility, scale, or specialized query patterns.
Document stores (MongoDB, Firestore) store JSON-like documents. No fixed schema. A document can have fields the next one lacks. Related data lives nested inside a single document rather than spread across tables.
Key-value stores (Redis, DynamoDB) are lookups by a key. Extremely fast. No query language beyond “get by key.”
Column-family (Cassandra) scales writes horizontally across many nodes. Time-series data and write-heavy workloads.
Graph databases (Neo4j) model relationships as first-class citizens. Social graphs, recommendation engines, fraud detection.
“NoSQL” does not mean one thing. A MongoDB instance and a Redis cluster solve completely different problems.
The Real Trade-Off
The difference comes down to structure and consistency.
SQL enforces structure. You define the schema upfront. The database guarantees that every row in users has an email column. Every query can rely on that. Joins work because the data model is normalized.
Document stores defer structure. Documents can evolve independently. Adding a field to one document does not require migrating every other document. That flexibility is valuable when the schema is not yet settled - and a liability when it is, because nothing stops bad data from getting in.
SQL prioritizes consistency. ACID transactions mean reads always see committed state. Two concurrent writes to the same row do not corrupt each other. This matters for financial records, inventory, and anything where correctness is not negotiable.
Most NoSQL systems prioritize availability and partition tolerance. Under network partitions, they will return potentially stale data rather than blocking. For most product features, this is fine. For a payment ledger, it is not.
When to Use SQL
- Financial or transactional data - anywhere money moves, ACID is non-negotiable.
- Complex relationships between entities - users, orders, products, reviews. Normalized tables and joins handle this cleanly. Trying to do it in a document store becomes painful fast.
- Known, stable schema - if the shape of the data is settled, schema enforcement prevents a class of bugs that silent document store writes allow.
- Reporting and analytics - SQL is extremely expressive. Complex aggregations, window functions, CTEs. Document store query languages are getting better but are not there yet for ad-hoc analysis.
- Teams that already know SQL - switching to a document store to feel modern is not worth the learning curve and tooling change.
When to Use NoSQL
- Document-shaped data - a product catalog where each product has completely different attributes. A CMS where articles have varying metadata. Forcing this into rows and columns is unnatural.
- Unstable or rapidly evolving schema - early product development where the data model is still changing every sprint. Document stores let you iterate without migrations.
- Session storage and caching - Redis is the right tool here. Key-value lookup, optional TTL, fast.
- Very high write volume with horizontal scaling - Cassandra is designed for this. Postgres can scale, but it takes more work.
- Graph-heavy queries - if the core queries are “find all friends of friends who bought X,” a graph database will outperform relational joins at scale.
The Myth of NoSQL Scalability
A persistent misconception is that NoSQL is faster or more scalable than SQL. This is a misreading of history.
The companies that moved to NoSQL at scale (Facebook, Twitter, early MongoDB adopters) had workloads where the specific trade-offs of those systems were worth it. They also had engineering teams large enough to manage the operational complexity.
A Postgres instance on modern hardware handles millions of rows and thousands of concurrent connections. Read replicas, connection pooling, and partitioning extend it further. Most applications will never hit a ceiling that requires moving off a relational database.
MongoDB is not faster than Postgres at retrieving a single document by ID. They are comparable. The difference is the shape of data and the guarantees you need, not raw throughput.
Mixing Both
Most production systems use more than one database. The common pattern:
- Postgres for core application data - users, orders, billing records.
- Redis for sessions, caching, and rate limiting.
- Elasticsearch for full-text search, if needed.
- S3 or object storage for files.
Each tool handles what it is good at. The mistake is using a single document store for everything because it feels simpler, then discovering two years later that reporting queries are painful and data integrity has drifted.
How to Decide
Ask three questions:
- Does this data have relationships that matter? If yes, SQL.
- Do I need consistency guarantees for this operation? If yes, SQL.
- Is the shape of this data genuinely variable or document-like? If yes, NoSQL may be a better fit.
For a new project with a small team and unclear requirements, Postgres is almost always the right starting point. It does more than you think, it grows with you, and the tooling is excellent. You can always add a document store or cache layer when you have a specific reason to.
Related Field Notes
Shared Tags[ ARTICLE_001 ]
06.06.2026
7 MIN
Modeling Relations in MongoDB
Embedding vs referencing, when each pattern breaks down, and how to use $lookup and Mongoose populate to query across documents.
[ ARTICLE_002 ]
06.15.2026
5 MIN
Fifteen Factors for Cloud-Native Applications
The original twelve-factor methodology established a baseline for portable, scalable apps. Three additional factors-API-first, telemetry, and security-complete the picture for modern cloud deployments.
[ ARTICLE_003 ]
06.05.2026
3 MIN
Service-Oriented Architecture and the ESB Trap
SOA introduced the right idea-bounded services communicating over contracts-but the Enterprise Service Bus turned coordination into a single point of control and failure.