Back to the map

Module 07 · Databases · Lesson 1 of 13

Common database types

The database families you will actually choose between, what each is shaped for, and the one question that picks among them: what does the access pattern look like? A map of the module before the deep dives.

IntroMust-knowJunior 9 min Updated Nov 2026

Why it matters

"Which database?" is the most common decision in a design interview and the most commonly fumbled, because candidates name a product before naming the access pattern. Every database family is a bet on a shape of data and a shape of query. Once you can say what shape your data and queries have, the choice mostly makes itself, and the rest of this module is about understanding each bet well enough to defend it.

The idea

A database is a storage engine (how bytes hit disk and get found again) plus a data model (how you think about the data) plus a query interface. The families below differ on all three, but the useful way to tell them apart is by what they make cheap.

FamilyData shapeMakes cheapMakes expensiveExamples
RelationalTables with rows and typed columns, relations via keysAd-hoc queries, joins, transactions across rows, integrity constraintsHorizontal write scaling, schema changes at huge scalePostgres, MySQL
DocumentSelf-contained JSON-like documentsReading or writing a whole entity at once, flexible per-record shapeJoins across documents, multi-document transactionsMongoDB, DynamoDB (document mode)
Key-valueOpaque value behind a keyGet and put by key at very high throughput and low latencyAnything that is not a key lookupRedis, DynamoDB, Riak
Wide columnRows with a partition key and sorted clustering columns, sparse columnsWrites at massive scale, range scans within a partitionAd-hoc queries, joins, secondary access pathsCassandra, HBase, Bigtable
GraphNodes and edges with propertiesTraversals: friends of friends, paths, neighbourhoodsAggregates over the whole graph, bulk analyticsNeo4j, Neptune
Time seriesTimestamped measurements per seriesAppend-heavy ingest, time-window aggregates, retention and downsamplingUpdates, point lookups by non-time attributesInfluxDB, TimescaleDB, Prometheus
SearchInverted index over text and fieldsFull-text relevance, faceting, fuzzy matchingBeing the source of truth, transactionsElasticsearch, OpenSearch, Meilisearch
VectorHigh-dimensional embeddingsNearest-neighbour similarity at scaleExact results, frequent updates of large indexespgvector, Pinecone, Milvus
Access patternreads? writes? shape?joins, integritykey lookups, huge write ratetext, time, graph, vectorsRelational coreKey-value / wide columnSpecialist storestart here by defaultwhen one table outgrows itfed from the core, not instead of it
Pick by access pattern first. Most systems end up with a relational core plus one or two specialists for the patterns it serves poorly.

The questions that pick

  1. 1

    What is the unit you read and write?

    A whole entity at a time suggests document or key-value. Pieces of many entities joined together suggests relational.
  2. 2

    What is the ratio and scale of reads to writes?

    Hundreds of thousands of writes per second with simple reads is wide-column territory. Complex reads with modest writes is relational.
  3. 3

    What guarantees do writes need?

    Money and inventory want transactions and constraints. Logs and events tolerate eventual consistency.
  4. 4

    What queries will you not predict?

    If analysts will ask questions you cannot foresee, keep a relational or warehouse copy; schemaless stores punish unforeseen queries.
  5. 5

    What is the special shape?

    Text relevance, time windows, graph hops and similarity each have a store built for exactly that, usually fed from the core rather than replacing it.

Polyglot persistence

Real systems run several databases, each for the access pattern it serves best, synchronised through events or change data capture. The discipline is to have one source of truth per entity and treat the specialists as derived, rebuildable views. Three stores you can rebuild are manageable; three stores that each own some of the truth is a consistency problem you will debug for years.

Trade-offs

Relational databases are the safest default and scale further than their reputation suggests, at the cost of harder horizontal write scaling. Specialist stores win on their one shape and lose everywhere else, and each one adds operational surface. The common mistake is choosing a NoSQL store for scale the system will never reach, and paying for missing joins and transactions every day until then.

In an interview

Name the pattern, then the store: "Orders need transactions and are queried in many ways, so Postgres is the source of truth. Product search needs relevance and facets, so a search index is fed from Postgres by change data capture. Session data is key lookups at high rate, so Redis." Then the default defence: "Start relational unless a concrete pattern proves it cannot cope."

Check yourself

A startup picks a wide-column store for its first product 'so it can scale later'. Six months in, every feature request involves a query the data model cannot serve without a full scan. What went wrong?

Common database types · Backplane