Data and databases

5 min readPublished Updated

SQL vs NoSQL: Why Database Choice Should Not Start With Technology

A database choice shapes the cost of future product changes. Product catalogues, stock reservations and new reporting requirements make the trade-offs concrete.

A new system has two database proposals. One recommends a relational database because the team knows how to operate it. The other recommends a document database because products have different attributes and the catalogue is expected to grow. Both arguments are reasonable. Neither yet explains what the company gets for the additional expense.

Start with the work the product must perform. How do customers search? Which changes must succeed together? What happens when two buyers request the last item? What reports will staff need? Those questions make storage differences tangible. Without them, the discussion is mostly about team preferences.

NoSQL is not a single alternative

Document databases, key-value stores and graph databases serve different access patterns. Treating them as one competitor to SQL obscures the decision. A user-session store and a system for exploring relationships between organisations may both be labelled NoSQL while doing very different jobs.

Relational models are useful when several entities are related and the application needs different ways of combining them. Document models let information commonly read together live together. The boundary is not absolute: PostgreSQL supports JSON and indexing it. Variable product attributes do not by themselves require another database technology.

A useful comparison names actual products, operating modes and limitations. Generalisations such as “SQL cannot scale” and “NoSQL has no transactions” get in the way. For example, MongoDB supports multi-document transactions. Investigate their scope and cost in the proposed deployment rather than awarding a feature to an entire category.

A catalogue and a reservation need different evidence

Consider a business selling equipment. Pumps and cables have different specifications. A document containing a product description, properties and nested components may be a convenient representation. Then a buyer wants to filter the entire catalogue by voltage, manufacturer and availability. Those are specific queries that still need suitable modelling and indexes.

A flexible structure does not eliminate data agreements. If some suppliers send power ratings as numbers, others as strings and others in different units, flexible storage can faithfully preserve every inconsistency. The application still needs input validation, conversion rules and a way to read older records after the model changes.

Now consider reserving stock. Two concurrent operations must not sell the same remaining item. The chosen system needs an appropriate mechanism: a conditional atomic update, locking, a transaction or another verified safeguard. Transaction support alone does not repair an incorrect read-then-update sequence.

If payment happens at an external provider, that provider does not automatically participate in your database transaction. The application must still reconcile payment and order states, retries and recovery. This problem remains with either SQL or NoSQL. A benchmark of writes to an isolated table will not reveal it.

Easy to read together can mean expensive to update

Read-oriented designs sometimes duplicate data. A supplier's name and address might be embedded in every product record. Changing that address then involves multiple copies. Decide whether updates must be immediate, whether temporary disagreement is acceptable and how missed updates will be detected.

Some duplication is intentional history. The delivery address on a completed order should not change when the customer edits their profile. That distinction concerns the meaning of the data, not allegiance to a database. Missing it can produce elaborate synchronisation for records that should have remained unchanged.

Future queries have a cost too. Today the application retrieves one product by ID. Tomorrow management wants customers who bought from a particular supplier and subsequently requested warranty support. Try that question against the proposed model. It may be a straightforward query, or it may require a new view, index or analytics pipeline.

A second database has a permanent operating bill

Several technologies can be justified: one system records authoritative transactions while another supports specialised search. But now somebody owns change propagation, lag monitoring, backups, upgrades and recovery across both systems. These responsibilities survive the launch.

A managed service can remove some infrastructure work. It does not design the data model or prove that the application can recover. Include copies, indexes, transfer charges, support, training and data export in the comparison. Cheap writes can coexist with expensive reads or an expensive exit.

Familiar technology deserves a genuine advantage here. When it satisfies the requirements and the team can operate it, avoiding another platform saves real work. That does not rule out an experiment. It establishes the baseline against which the experiment should demonstrate value.

What the comparison should produce

A bounded prototype is enough; building the product twice is unnecessary. Test a common query, a demanding selection, a concurrent update and a plausible upcoming requirement. Use realistic skew: a popular item, a large customer and a long history. Uniform synthetic data can hide precisely the behaviour that will be expensive in production.

Agree in advance on acceptable response times and recovery expectations. Compare resource use and the surrounding application code, not only the database's isolated speed. Restore a backup and perform a small schema change. These exercises expose work that a successful search demonstration leaves out.

The decision can end as a short record: the operations that matter, why this model fits, the disadvantages accepted and the observable conditions that would justify revisiting it. Management gets a basis for funding; engineering gets a review trigger rather than a promise never to change databases again.