Use SQL when your data is relational, your transactions must be atomic across multiple records, and you need ad hoc queries whose shape you can't fully predict. Use NoSQL when one known access pattern dominates, you need to scale writes horizontally past what a single relational primary can absorb, or your schema is genuinely document-, key-, or graph-shaped. The deciding factor isn't "modern vs legacy" — it's whether your read and write patterns were knowable at design time and whether cross-entity consistency is a hard requirement.

That framing matters because the SQL/NoSQL split is often taught as a technology war when it's really a modeling decision. A system can run PostgreSQL and still be "NoSQL-like" in its access design (denormalized JSON columns, single-table key-value hits). It can run MongoDB and still enforce relational discipline in application code. What changes the outcome is the shape of your data, the consistency your business logic needs, and the scale profile of your workload.

This article breaks that decision into the criteria that actually change architecture choices, explains the mechanisms behind each, and shows where each option fits — including the hybrid and migration paths most real systems end up taking.

The real axis: data shape, not brand names

"SQL" means a relational database with a fixed schema, joins, and ACID transactions — PostgreSQL, MySQL, SQL Server, Oracle. "NoSQL" is an umbrella for four families that behave quite differently:

Document stores (MongoDB, CouchDB, Firestore): nested JSON-like records, flexible per-document schema. Key-value stores (Redis, DynamoDB, Riak): a key maps to an opaque value; lookup is the whole game. Wide-column stores (Cassandra, HBase, Bigtable): rows keyed by partition and clustering columns, optimized for range scans along a partition. Graph databases (Neo4j, Amazon Neptune): nodes and edges as first-class citizens, efficient multi-hop traversal.

Grouping these under one label hides the fact that a document store and a wide-column store make opposite trade-offs. So the useful question is never "SQL or NoSQL?" but "which family matches my access pattern, and what am I giving up?" The table below compares on identical criteria rather than marketing categories.

Criterion Relational (SQL) Document Key-value / wide-column Graph
Schema Fixed, enforced by engine Flexible per document Key structure is the schema Property graph, flexible
Consistency default Strong, ACID across rows Tunable; strong within a document Often eventual on replicas Strong within a transaction
Joins Native, any shape Limited (lookup or $lookup-style) Typically none Native via traversal
Scaling model Vertical primary + read replicas; sharding is manual work Sharding by shard key built in Horizontal partition by design Vertical or clustered replicas
Best query shape Ad hoc, multi-entity, evolving Fetch a whole aggregate by id/field Exact key or partition range Multi-hop relationships
Migration pain Schema migrations are routine but real Schema drift can accumulate silently Rarely — data model is the access path Model changes ripple through traversal logic

The two rows that most often decide real projects are joins and scaling model. Flexible schema sounds liberating until you discover that data integrity didn't disappear — it moved into your application code, where it's harder to test and easier to violate.

When SQL is the right default

Relational databases earn their default status for a specific reason: the shape of the query is not known when you design the schema. When a product team will ask for "top customers by revenue in region X who churned last quarter," a relational engine answers that with a join and an index. A key-value store answers it only if you precomputed that exact view.

Reach for SQL when:

Your entities are genuinely relational. Orders reference customers, line items reference products, invoices reference both. In a relational store, foreign keys and joins enforce and query those links. In a document store, you either embed the aggregate (fine when the order is the unit of retrieval) or duplicate references (fine until a customer address updates in a thousand documents).

Multiple records must change atomically. A bank transfer debits one account and credits another. A relational engine gives you a transaction that either commits both or neither. Many NoSQL systems offer single-document atomicity but require distributed transactions (like DynamoDB's TransactWriteItems or MongoDB's multi-document transactions) for cross-entity guarantees, which add latency and complexity. If your invariants span entities, SQL's default ACID behavior is a genuine architectural asset.

Ad hoc and reporting queries matter. Analysts, dashboards, and internal tools will query in shapes you never anticipated. Relational engines with a query optimizer handle that. Document and key-value stores push that work into application code or into a separate analytical pipeline (often a warehouse loaded from event streams).

The dataset fits a primary with replicas. A well-tuned PostgreSQL instance on modern hardware handles millions of rows and thousands of transactions per second for typical OLTP workloads. Vertical scaling goes further than intuition suggests, and read replicas absorb most read-heavy traffic. The "SQL doesn't scale" claim is true for a specific regime — write volume and dataset size beyond a single primary's capacity — not as a general statement.

Schema change is governed. In regulated domains, migrations reviewed and applied deliberately are a feature. A relational schema is a named contract you can version and audit.

The honest drawback of SQL: horizontal write scaling is genuinely hard. Sharding a relational database (via Citus, Vitess, application-level routing) is real engineering work, and joins across shards become expensive or prohibited. If you're planning for write throughput that a single primary can't deliver, that's a legitimate signal to consider a different model for that specific workload — not necessarily for the whole system.

When NoSQL fits better

NoSQL wins when the access pattern is known, the volume is large, and the consistency cost is acceptable or unnecessary.

One dominant access pattern with high write volume. A telemetry pipeline writing 200,000 events per second, where the only query is "fetch events for device D between two timestamps," is a natural wide-column shape. You partition by device and cluster by time; reads and writes hit exactly one partition. A relational engine can do this, but it spends cycles on features (multi-table joins, cross-row transactions) the workload never uses, and the single-primary write ceiling arrives sooner.

The unit of retrieval is a whole aggregate. A user profile, a product listing with its variants, a CMS article with embedded blocks — each fetched and written as one document. Document stores shine here because the aggregate is the record. You avoid joins entirely because there are none to make.

Latency at a fixed cost. Key-value stores like Redis and DynamoDB deliver single-digit-millisecond lookups at scale with predictable billing. When a session store or a feature flag service needs a lookup, a distributed key-value layer is the lower-complexity answer.

Relationships are the star and are multi-hop. Graph databases exist because "friends of friends who bought this" is a multi-hop traversal that relational engines execute as repeated self-joins whose cost compounds with depth. If that traversal sits at the core of the product, a graph model expresses it in one declarative step.

The honest drawbacks: eventual consistency is a business decision, not a checkbox. A replica lag of even a few hundred milliseconds means a user can write a comment and not see it on refresh. Some products tolerate that; a payments ledger does not. And schema drift is silent. Without enforcement at the storage layer, one service writes a field as a string, another as an object, and the bug surfaces weeks later in a downstream consumer.

Scale thresholds and the arithmetic behind them

Design choices about scaling should come with rough numbers, not slogans. These are illustrative estimates — the inputs change with hardware, indexing, and workload mix — but they show the kind of arithmetic worth doing before choosing.

Suppose an order service expects 3,000 writes per second sustained, each write touching an order row and several line-item rows, with a uniqueness constraint on order number. On a single primary, each write is a transaction of several row operations plus a unique-index check. At that rate, contention on the index and WAL fsync become the bottleneck well before CPU; a single primary often handles a few thousand such transactions per second, and headroom disappears fast. The options then are: shard the relational store by tenant or customer (complex but preserves joins within a shard), or move the high-write path to a partitioned store keyed by order id (simpler write path, but you lose cross-order transactional guarantees).

Now suppose the system also needs to report daily order totals by region. That query wants aggregation across all orders — that is, across every partition if you sharded. In a partitioned NoSQL design, you'd typically pipe writes to a stream and aggregate in a warehouse, adding minutes of latency to reporting. In a relational design, it's a GROUP BY — at the cost of writing to one primary.

The lesson: the scale threshold isn't a row count. It's a conjunction — write rate above what a primary sustains and queries whose shape you can't precompute and cross-entity invariants you can't relax. Any one of those alone doesn't force a change. All three together usually means splitting the workload across two stores rather than picking one side.

One more number worth separating: throughput and dataset size decouple. A 50 GB dataset with a brutal write rate is a write-scaling problem; a 5 TB dataset with modest writes is often a vertical-scaling or read-replica problem. Mixing the two into "we're too big for SQL" obscures which lever to pull.

Polyglot persistence in practice

Most high-scale systems end up using both, deliberately, with a clear rule for what lives where. A common and defensible split:

Relational primary holds the entities that carry invariants: accounts, orders, entitlements, billing. These are written under transactions. Search index (Elasticsearch/OpenSearch) holds a denormalized projection for full-text and faceted queries, fed from the primary via change-data-capture. Cache or key-value layer holds sessions, rate-limit counters, and hot reads with a TTL, populated on demand. Wide-column or document store holds high-volume event or content data whose access pattern is fixed. Warehouse holds the analytical history, loaded from the same event stream.

The critical discipline in polyglot designs is one source of truth per fact. If the order total lives in both the relational primary and a document store, they will diverge; one must be derived, and the derivation must be observable. Write to the primary, project asynchronously, and let consumers tolerate staleness — or read-through to the primary when freshness is required. The complexity of dual writes is real, which is why the reliable pattern is transactional outbox plus a consumer, not writing to two stores in one request handler.

This is also where the "SQL-vs-NoSQL" question dissolves at the system level: the right unit of choice is the workload or the bounded context, not the company. A monolith can run PostgreSQL for its ledger and Redis for sessions and be perfectly orthodox.

Consistency and transactions: the cost of crossing entities

Consistency deserves its own section because it's where design decisions get expensive.

Relational engines default to the strongest practical guarantees: serializable or snapshot isolation, atomic multi-row commits, and constraints enforced at the storage layer. NoSQL families vary widely. DynamoDB offers strongly consistent reads and transactional writes across up to 100 items per transaction (as of current documentation), but every transactional write costs extra capacity and coordination. MongoDB supports multi-document transactions but with a performance cost that grows with transaction size and duration. Cassandra's model is tunable consistency per operation, and cross-partition transactions are not a given. Graph databases typically provide ACID within a graph but may not be distributed.

The design implication: if your invariants cross entities, you will pay for them somewhere. Either the database enforces them (SQL, or a NoSQL system with transactions) or your application does — with compensations, sagas, or reconciliation jobs. Sagas are a legitimate and common pattern in distributed systems, but they shift correctness work into code, testing, and operations. For a ledger, that shift is usually a bad trade. For a content platform, it's routine.

A concrete failure mode to plan around: read-your-own-writes. A user submits a form, the request writes to a catch-up replica, and the next page load reads a stale replica and shows the old value. Load balancers that route by session or primary-for-writes/replica-for-reads solve it. If your chosen store doesn't let you route, the UX glitch is guaranteed.

Migration and lock-in: what changing your mind costs

The choice is rarely permanent, but it isn't cheap either, and the asymmetry matters.

SQL → NoSQL is usually forced by scale or a specific access pattern. It means re-modeling: deciding which entities become aggregates, which become separate records, and how you'll precompute the views you previously expressed as joins. Application code that relied on JOIN usually gets rewritten as multiple lookups or denormalized copies. Reporting moves to a separate pipeline. Done incrementally, this is manageable per bounded context — and it's why teams often keep the relational primary for core entities and add a NoSQL layer for the hot workload.

NoSQL → SQL is less common but happens when consistency or query flexibility becomes load-bearing — a product feature requires a join, or auditors require transactional guarantees. That migration means reconciling a schema that drifted (document stores don't enforce one), deduplicating and normalizing data, and rebuilding queries that were previously hand-coded lookups. Data migration is the hard part; schema reconciliation is the expensive part.

Either direction, the hedge that keeps options open is the same: keep the primary entities relational unless you have a specific, measured reason not to; keep projection stores derivable from a source of truth; and instrument what your workload actually does before committing. That rare advantage of a measured load profile over a speculative "we might scale" is the single most reliable input to this decision.

A short decision procedure

1: List the entities and every access pattern, including reporting and ad hoc queries, with a rough read/write ratio and growth estimate. This is the only prerequisite; without it, everything downstream is guesswork. 2: Mark the invariants that must never be violated — balances, entitlements, uniqueness. If they span entities and cannot be relaxed or compensated, favor a store with cross-entity transactions. 3: Identify the dominant, high-volume access pattern. If it's a whole-aggregate fetch, a known partition key, a multi-hop traversal, or pure key lookup, a matching NoSQL family fits. 4: Estimate write volume against a single primary. If the sustainable rate is within reach, SQL with replicas is the lower-complexity design. If not, consider partitioning just that workload. 5: Check consistency tolerances per read path. Mark any read path that needs read-your-writes or strict freshness; plan routing around it. 6: Choose the deployment shape: one store for the whole system, or a primary relational core plus derived projections. Record the rule for what lives where. 7: Plan the exit. Name the signal that would trigger a migration or splitting off a workload, and keep projection stores rebuildable so the option stays open.

Step 1 is the one teams skip. A concrete check: take every screen and API the product has, write down the query it needs, and see whether each one maps to a key, a partition, a traversal, or a join. If most queries are joins and their shape will change with features, that's the answer.

Where each option fits in common systems

Concrete fits make the criteria tangible:

Financial ledger or billing: SQL, without argument. Multi-entity invariants, auditability, and transactional safety are the product. Product catalog with faceted search: relational primary for canonical product data plus a search index for queries; the catalog's own records may live as documents if they're aggregate-shaped. Session and feature-flag service: key-value, for lookup latency and predictable cost at volume. IoT or observability events: wide-column partitioned by device and time, with an analytical warehouse downstream. A social graph where recommendations traverse connections: graph database for the traversal workload, with identity records in a relational or document store. An early-stage app with unpredictable queries: default to a relational database. It handles the flexibility of a young product better than most teams expect, and premature NoSQL adoption often means re-modeling once the queries become known.

Two judgment calls are worth flagging as preferences, not engineering necessities: team familiarity and operational tooling. A team that knows PostgreSQL deeply will run it more reliably than a team learning Cassandra under load, at equal architectural merit. That's a legitimate tie-breaker, not a confession.

FAQ

Can a relational database handle JSON documents as well as a document store? PostgreSQL's jsonb with indexing covers a lot of document-shaped patterns — flexible attributes, nested fields, and containment queries — while preserving transactions and joins. It's a common pragmatic middle. What it typically lacks is the horizontal write-scale model of a partitioned document store; whether that matters depends on your rate.

Doesn't "schemaless" mean I never deal with migrations? No. Schema enforcement moves from the database to application code and data pipelines. You still change shape; you just lose the database's help in detecting violations — which is why many teams keep a schema validation layer even on document stores.

Is eventual consistency always acceptable when a NoSQL store says so? Only per read path. A product can tolerate eventual consistency for a like counter and not for an account balance. Decide per feature, not per database. The default choice should be strong where invariants live.

Will NoSQL save money at scale? Sometimes, but the cost comparison is rarely like-for-like. Managed pricing, read/write capacity, cross-region replication, and the engineering time to build application-side joins and projections all count. The bill is the whole pipeline, not the primary database.

What about NewSQL (CockroachDB, Spanner-style systems)? These combine relational semantics with horizontal scaling and distributed transactions. They're a real option when you need both properties, at the cost of higher coordination latency and operational complexity. They change the shape of the trade-off rather than removing it.

Does the "reference date" matter here? This article describes stable architectural principles; specific product capabilities, limits, and managed pricing change over time and should be checked against current vendor documentation for any concrete adoption decision.