2 · SQL & databases

5. NoSQL Families and When to Use Them

Key-value, document, wide-column, graph and search engines — and polyglot persistence.

10 min read · 3 MCQs

The families

Key-value (Redis, DynamoDB) gives O(1) lookup by key. Document stores (MongoDB, Firestore) hold nested JSON per entity. Wide-column stores (Cassandra, Bigtable) scale writes across partitions. Graph databases (Neo4j) traverse relationships cheaply. Search engines (Elasticsearch, OpenSearch) do inverted-index text and facet queries.

Model for the query

Relational modelling starts from entities; NoSQL modelling starts from access patterns. Denormalise and duplicate deliberately, choose a partition key that spreads load and keeps related items together, and accept that changing the access pattern later may mean a migration.

Polyglot persistence

Real systems mix stores: Postgres as the transactional source of truth, Redis for cache and rate limits, a search index for text, and a warehouse for analytics. Each extra store adds a consistency boundary, so add one only when a real limitation demands it.

Chapter quiz

3 questions · pass mark 75%
  1. 1. NoSQL data modelling should start from…

  2. 2. A poorly chosen partition key causes…

  3. 3. Graph databases are strongest for…

Answer every question to submit. Progress for da-05 is saved in this browser.