Choosing a database for a new service

NoSQL and choosing a database Mid-level Python 3.13+ PostgreSQL 17+ Reviewed By Best Latest Apps

Order the steps

Order the decision process for a new service's database.

  • Add a specialised store only for an unmet, measured need
  • List entities, invariants and access patterns
  • Check whether PostgreSQL (with JSONB, FTS, partitions) meets them
  • Estimate volumes and latency needs

Choose an answer, then open Show answer below to check it.

Show answer

Answer: B D C A

  1. List entities, invariants and access patterns What must always be true, what's queried how.
  2. Estimate volumes and latency needs Numbers, not adjectives.
  3. Check whether PostgreSQL (with JSONB, FTS, partitions) meets them The default with the fewest moving parts.
  4. Add a specialised store only for an unmet, measured need And plan how data reaches it.

30-second answer

Start from the data and access patterns: what's read and written, how often, with what consistency, and which invariants must hold across records. Default to a well-understood relational database (PostgreSQL) because it covers transactions, constraints, joins, JSONB and full-text search. Add a specialised store only for a measured need it serves better: Redis for caching and counters, a search engine for ranked text search, a wide-column or time-series store for very high write volumes.

Practise saying it · 35 s. No recording, just a timer

How do you choose a database?

Say your answer out loud, then check which of these points you covered:

  • Access patterns and invariants
  • Numbers
  • Relational default
  • Specialise on evidence
  • Operational cost

Deep dive

Operational cost counts: backups, upgrades, monitoring and on-call knowledge for each new store.

Managed services reduce, but don't remove, that cost.

Polyglot persistence needs a plan for keeping copies in sync (events, CDC).

Write the expected numbers down (QPS, data size, growth) before deciding.

Common mistakes

  • Choosing by hype or résumé.
  • Adding a second database before measuring the first's limits.
  • Ignoring backup and restore.

Senior take & follow-ups

Access patterns and invariants first, PostgreSQL default, specialise on evidence, count operational cost.

Follow-up questions

Think of your answer first, then open the hint.

  1. What numbers do you need?

    Show hint

    Reads and writes per second, data size and growth, latency targets, consistency needs.

  2. When is a second store justified?

    Show hint

    When a measured need can't be met well by the first.

Suggest a fix if something here is wrong or out of date.