Skip to content
Ameen Abozaid
MID-044

Data selection

  • 4 Lessons
  • 2 h practice (estimate)
On this page 8 topics

Overview

Topics

  • PostgreSQL vs Redis vs MongoDB vs search engines
  • workload-driven decisions

Learn first

2 h of practice (estimate)

Learning outcomes

  1. Characterize a workload (access patterns, volume, consistency, latency, query flexibility).
  2. Select a store from that characterization and justify it in an ADR.
  3. Count the operational cost of each additional datastore.

Lessons

  1. 01Characterizing a workload
  2. 02PostgreSQL first, and when not
  3. 03The operational cost of another database
  4. 04Demo: writing the reviews datastore ADR

Lab and exercises

Lab

MID-044-LAB1 · Datastore ADRs

Outcomes: 1–3 · Time: ~2 h Write one ADR each for Shop's catalog, orders, reviews, search, and sessions. Each ADR has context, workload characterization with evidence, options, decision, consequences, operational cost, and a revisit trigger. Acceptance: each cites workload evidence; at least one concludes "PostgreSQL is enough".

Exercises (assessment: ADR review)

IDOutcomeTask
MID-044-EX011Characterize the sessions workload with the template (access, volume, consistency, latency, flexibility).
MID-044-EX022Pick a store for each: orders, product search, rate-limit counters, product reviews at 2 M rows; justify in one line.
MID-044-EX033List the operational costs of adding MongoDB to a team that runs only PostgreSQL.
MID-044-EX042Review this ADR: "We use MongoDB because it is modern and scalable." List what is missing.
MID-044-EX052Write the revisit triggers for the reviews ADR.
Show solutions
  • EX01 Point lookups by token, high read and write, small values, short TTL, loss tolerable (re-login), latency milliseconds, no query flexibility: a key-value store with TTL.
  • EX02 Orders: PostgreSQL (transactions). Search: OpenSearch if facets and typos matter, else PostgreSQL FTS. Counters: Redis. Reviews at 2 M rows: PostgreSQL is enough.
  • EX03 Provisioning, backup and restore tests, monitoring and alerts, upgrades, security, runbooks, skills and on-call, data sync and consistency.
  • EX04 Workload numbers, alternatives considered, consequences, operational cost, revisit trigger, and why PostgreSQL was rejected.
  • EX05 Example: review volume above 200 M, write rate above 5 000/s, or read latency targets missed after indexing and partitioning.

Outcome 1 is also covered by the lab (workload evidence in each ADR).

Quiz

Outcomes: O1 characterize a workload · O2 select and justify · O3 operational cost.

A self-check for you: nothing is graded, saved or sent anywhere. Choose an answer, then check it. You can try again as often as you like.

  1. 1Which is NOT part of workload characterization?O1
  2. 2Evidence for a workload should come from:O1
  3. 3"Query flexibility" asks:O1
  4. 4A sensible default store for orders is:O2
  5. 5An ADR must include:O2
  6. 6"PostgreSQL is enough" as an ADR conclusion is:O2
  7. 7Rate-limit counters with TTL fit best:O2
  8. 8Which is an operational cost of another database?O3
  9. 9Keeping a second store in sync adds:O3
  10. 10Which choice rationale is weakest?O3

Practical part

ADR review (MID-044-EX04) plus lab MID-044-LAB1 (five ADRs). Pass: quiz at least 8/10, every ADR citing evidence, and at least one concluding that PostgreSQL is enough.

Common mistakes

Choosing by popularity; ignoring backup, monitoring, and skills cost.

Assessment

ADR review.

Career relevance

Technology evaluation (SRB-013) and database architecture (ARC-016).

Type to search levels, phases, modules and lessons.