Questions: Key-Value Stores

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

An application stores user profiles in PostgreSQL (200ms per query). A developer proposes caching results in Redis with a 5-minute TTL. A colleague objects: 'Key-value stores shouldn't hold data that's also in our relational database.' Who is correct?

AThe colleague — key-value stores should never duplicate data from a relational database
BThe developer — Redis should replace PostgreSQL for user profiles since it's faster
CThe developer — using Redis as a cache layer in front of PostgreSQL is a common and appropriate pattern; TTL manages staleness
DNeither — the right solution is to optimize the SQL query itself
Question 2 Multiple Choice

A product manager asks the backend team to use their existing Redis cluster to answer: 'Which users in New York signed up in the last 7 days?' An engineer says this is not what key-value stores are designed for. Why?

ARedis does not support storing user data — it is only for caching computed values
BRedis has no secondary indexes, so finding all keys matching a criterion requires a full scan — the O(1) model only applies to individual key lookups by exact key
CRedis data expires too quickly through TTL to support historical queries
DKey-value stores only work for session data and cannot store location or date information
Question 3 True / False

Redis is an in-memory store and therefore can seldom persist data to disk, making it unsuitable for any use case where data is expected to survive a server restart.

TTrue
FFalse
Question 4 True / False

Cache invalidation — deciding when to evict or update cached data — is a problem that key-value stores solve automatically through TTL expiration.

TTrue
FFalse
Question 5 Short Answer

What is the fundamental tradeoff of the key-value data model, and why does this make key-value stores a complement to relational databases rather than a replacement?

Think about your answer, then reveal below.