Back to Notes

Questions to Ask Before Choosing a Database

Every new project reaches the same moment early on: someone opens a doc titled "Tech Stack" and types Database: followed by a blank.

It is tempting to fill it with whatever the team used last time, or whatever was trending on Hacker News that week. But the database is one of the few decisions in a system that is genuinely hard to undo. Frameworks, UI libraries, even languages can be swapped piece by piece. Your data, and every query written against it, is far harder to move.

The problem is not a lack of options. It's that there are too many, and each one is excellent at something different.


The Database Landscape in One Pass

At the highest level, databases split into two families.

Relational (SQL)

PostgreSQL, MySQL, SQL Server, Oracle.

Data lives in tables with a fixed schema. Rows relate to each other through foreign keys, and you combine them at query time with joins. You get ACID transactions, strong consistency, and a query language (SQL) that can answer questions you didn't plan for.

This is the default for structured data, and for good reason: it has been battle-tested for decades.

Non-Relational (NoSQL)

"NoSQL" isn't one thing. It's a bucket of very different designs, each built to drop some relational guarantee in exchange for something else.

Specialised Databases

Then there are databases built for one specific type of workload:

So the real question is not "SQL or NoSQL?" It's "what does my workload actually need?" And the way to answer that is to ask the right questions before writing the first migration.


1. What Does Your Data Look Like?

Start with the data model. This question alone often narrows the list to two or three options.


2. How Will You Read and Write It?

This one is often skipped, and it matters as much as the data model. Access patterns decide whether a database will feel fast or painful.


3. How Much Scale, Really?

Be honest here. Most applications never reach the scale that would justify an exotic database.


4. How Consistent Does It Need to Be?

When data is copied across multiple nodes, you have to decide what happens when they briefly disagree. There are three broad models.

A useful exercise: for each feature, ask "what's the worst thing that happens if the user sees data that's 2 seconds old?" If the answer is "they get charged twice," you need strong consistency there.


5. How Fast Does It Need to Respond?

Latency requirements push you toward certain architectures.


6. Does It Need to Work Offline?

This matters most for mobile and field apps: delivery drivers, health workers, note-taking apps, anything used on a flaky connection.

CouchDB + PouchDB were designed for exactly this: each device holds a local copy, and replication syncs changes both ways. Firestore has built-in offline persistence for mobile and web clients. Retrofitting offline sync onto a database that wasn't designed for it is one of the hardest problems in app development, so decide early.


7. Who Is Going to Run It?

The best database on paper can be the worst in practice if no one on the team knows how to operate it.


The Migration Tax

The reason all these questions matter is simple: switching databases later is very expensive.

A database migration is rarely a weekend job. It usually looks like this:

11. Dual-write App writes to OLD and NEW databases
2 │
3 ▼
4 2. Backfill Copy years of historical data into NEW
5 │
6 ▼
7 3. Verify Compare results; fix data that doesn't match
8 │
9 ▼
10 4. Shadow reads Read from NEW, compare with OLD, log mismatches
11 │
12 ▼
13 5. Cut over Switch reads to NEW, keep OLD as a fallback
14 │
15 ▼
16 6. Decommission Finally turn off OLD (months later)

And along the way:

This doesn't mean you should never migrate. Sometimes it's the right call. It means the questions above are worth an afternoon of thinking before you choose, because the cost of a wrong answer is paid in months, not hours.


Quick Reference

Most real systems end up using more than one of these. A typical stack might use PostgreSQL as the source of truth, Redis for caching, and Elasticsearch for search. That's normal, and it's called polyglot persistence.


Closing Thoughts

Here's the honest truth: nobody knows for sure which database is right.

If they did, we wouldn't keep seeing engineering blogs from the biggest companies in the world explaining why they moved from one database to another:

These are teams full of brilliant engineers, and they still changed course. Not because they chose badly at first, but because the product, the scale, and the data changed under them. The database that was right for 1 million messages wasn't right for 1 trillion.

There is no single database that solves every problem. Each one is a set of trade-offs, and the job is to pick the trade-offs you can live with today, while keeping an eye on what might break tomorrow.

So ask the questions. Write down the answers. Pick the simplest thing that fits. And when the answers change, you'll know exactly why it's time to revisit the decision.


Takeaway: There is no "best" database, only the one that best fits your data, your queries, and your team right now.

Back to Notes